Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

handlebars

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handlebars - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

.eslintrc

88

dist/amd/handlebars.js

@@ -1,54 +0,54 @@

define(
["./handlebars.runtime","./handlebars/compiler/ast","./handlebars/compiler/base","./handlebars/compiler/compiler","./handlebars/compiler/javascript-compiler","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __exports__) {
"use strict";
/*globals Handlebars: true */
var Handlebars = __dependency1__["default"];
define(['exports', 'module', './handlebars.runtime', './handlebars/compiler/ast', './handlebars/compiler/base', './handlebars/compiler/compiler', './handlebars/compiler/javascript-compiler', './handlebars/compiler/visitor'], function (exports, module, _handlebarsRuntime, _handlebarsCompilerAst, _handlebarsCompilerBase, _handlebarsCompilerCompiler, _handlebarsCompilerJavascriptCompiler, _handlebarsCompilerVisitor) {
'use strict';
// Compiler imports
var AST = __dependency2__["default"];
var Parser = __dependency3__.parser;
var parse = __dependency3__.parse;
var Compiler = __dependency4__.Compiler;
var compile = __dependency4__.compile;
var precompile = __dependency4__.precompile;
var JavaScriptCompiler = __dependency5__["default"];
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj['default'] : obj; };
var _create = Handlebars.create;
var create = function() {
var hb = _create();
var _Handlebars = _interopRequire(_handlebarsRuntime);
hb.compile = function(input, options) {
return compile(input, options, hb);
};
hb.precompile = function (input, options) {
return precompile(input, options, hb);
};
// Compiler imports
hb.AST = AST;
hb.Compiler = Compiler;
hb.JavaScriptCompiler = JavaScriptCompiler;
hb.Parser = Parser;
hb.parse = parse;
var _AST = _interopRequire(_handlebarsCompilerAst);
return hb;
};
var _JavaScriptCompiler = _interopRequire(_handlebarsCompilerJavascriptCompiler);
Handlebars = create();
Handlebars.create = create;
var _Visitor = _interopRequire(_handlebarsCompilerVisitor);
/*jshint -W040 */
/* istanbul ignore next */
var root = typeof global !== 'undefined' ? global : window,
$Handlebars = root.Handlebars;
/* istanbul ignore next */
Handlebars.noConflict = function() {
if (root.Handlebars === Handlebars) {
root.Handlebars = $Handlebars;
}
var _create = _Handlebars.create;
function create() {
var hb = _create();
hb.compile = function (input, options) {
return _handlebarsCompilerCompiler.compile(input, options, hb);
};
hb.precompile = function (input, options) {
return _handlebarsCompilerCompiler.precompile(input, options, hb);
};
Handlebars['default'] = Handlebars;
hb.AST = _AST;
hb.Compiler = _handlebarsCompilerCompiler.Compiler;
hb.JavaScriptCompiler = _JavaScriptCompiler;
hb.Parser = _handlebarsCompilerBase.parser;
hb.parse = _handlebarsCompilerBase.parse;
__exports__["default"] = Handlebars;
});
return hb;
}
var inst = create();
inst.create = create;
inst.Visitor = _Visitor;
/*jshint -W040 */
/* istanbul ignore next */
var $Handlebars = global.Handlebars;
/* istanbul ignore next */
inst.noConflict = function () {
if (global.Handlebars === inst) {
global.Handlebars = $Handlebars;
}
};
inst['default'] = inst;
module.exports = inst;
});

@@ -1,50 +0,49 @@

define(
["./handlebars/base","./handlebars/safe-string","./handlebars/exception","./handlebars/utils","./handlebars/runtime","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __exports__) {
"use strict";
/*globals Handlebars: true */
var base = __dependency1__;
define(['exports', 'module', './handlebars/base', './handlebars/safe-string', './handlebars/exception', './handlebars/utils', './handlebars/runtime'], function (exports, module, _handlebarsBase, _handlebarsSafeString, _handlebarsException, _handlebarsUtils, _handlebarsRuntime) {
'use strict';
// Each of these augment the Handlebars object. No need to setup here.
// (This is done to easily share code between commonjs and browse envs)
var SafeString = __dependency2__["default"];
var Exception = __dependency3__["default"];
var Utils = __dependency4__;
var runtime = __dependency5__;
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj['default'] : obj; };
// For compatibility and usage outside of module systems, make the Handlebars object a namespace
var create = function() {
var hb = new base.HandlebarsEnvironment();
// Each of these augment the Handlebars object. No need to setup here.
// (This is done to easily share code between commonjs and browse envs)
Utils.extend(hb, base);
hb.SafeString = SafeString;
hb.Exception = Exception;
hb.Utils = Utils;
hb.escapeExpression = Utils.escapeExpression;
var _SafeString = _interopRequire(_handlebarsSafeString);
hb.VM = runtime;
hb.template = function(spec) {
return runtime.template(spec, hb);
};
var _Exception = _interopRequire(_handlebarsException);
return hb;
};
// For compatibility and usage outside of module systems, make the Handlebars object a namespace
function create() {
var hb = new _handlebarsBase.HandlebarsEnvironment();
var Handlebars = create();
Handlebars.create = create;
_handlebarsUtils.extend(hb, _handlebarsBase);
hb.SafeString = _SafeString;
hb.Exception = _Exception;
hb.Utils = _handlebarsUtils;
hb.escapeExpression = _handlebarsUtils.escapeExpression;
/*jshint -W040 */
/* istanbul ignore next */
var root = typeof global !== 'undefined' ? global : window,
$Handlebars = root.Handlebars;
/* istanbul ignore next */
Handlebars.noConflict = function() {
if (root.Handlebars === Handlebars) {
root.Handlebars = $Handlebars;
}
hb.VM = _handlebarsRuntime;
hb.template = function (spec) {
return _handlebarsRuntime.template(spec, hb);
};
Handlebars['default'] = Handlebars;
return hb;
}
__exports__["default"] = Handlebars;
});
var Handlebars = create();
Handlebars.create = create;
/*jshint -W040 */
/* istanbul ignore next */
var root = typeof global !== 'undefined' ? global : window,
$Handlebars = root.Handlebars;
/* istanbul ignore next */
Handlebars.noConflict = function () {
if (root.Handlebars === Handlebars) {
root.Handlebars = $Handlebars;
}
};
Handlebars['default'] = Handlebars;
module.exports = Handlebars;
});
/*global window */

@@ -1,247 +0,268 @@

define(
["./utils","./exception","exports"],
function(__dependency1__, __dependency2__, __exports__) {
"use strict";
var Utils = __dependency1__;
var Exception = __dependency2__["default"];
define(['exports', './utils', './exception'], function (exports, _utils, _exception) {
'use strict';
var VERSION = "3.0.1";
__exports__.VERSION = VERSION;var COMPILER_REVISION = 6;
__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.x.x',
5: '== 2.0.0-alpha.x',
6: '>= 2.0.0-beta.1'
};
__exports__.REVISION_CHANGES = REVISION_CHANGES;
var isArray = Utils.isArray,
isFunction = Utils.isFunction,
toString = Utils.toString,
objectType = '[object Object]';
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj['default'] : obj; };
function HandlebarsEnvironment(helpers, partials) {
this.helpers = helpers || {};
this.partials = partials || {};
exports.__esModule = true;
exports.HandlebarsEnvironment = HandlebarsEnvironment;
exports.createFrame = createFrame;
registerDefaultHelpers(this);
}
var _Exception = _interopRequire(_exception);
__exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = {
constructor: HandlebarsEnvironment,
var VERSION = '3.0.1';
exports.VERSION = VERSION;
var COMPILER_REVISION = 6;
logger: logger,
log: log,
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.x.x',
5: '== 2.0.0-alpha.x',
6: '>= 2.0.0-beta.1'
};
registerHelper: function(name, fn) {
if (toString.call(name) === objectType) {
if (fn) { throw new Exception('Arg not supported with multiple helpers'); }
Utils.extend(this.helpers, name);
} else {
this.helpers[name] = fn;
}
},
unregisterHelper: function(name) {
delete this.helpers[name];
},
exports.REVISION_CHANGES = REVISION_CHANGES;
var isArray = _utils.isArray,
isFunction = _utils.isFunction,
toString = _utils.toString,
objectType = '[object Object]';
registerPartial: function(name, partial) {
if (toString.call(name) === objectType) {
Utils.extend(this.partials, name);
} else {
if (typeof partial === 'undefined') {
throw new Exception('Attempting to register a partial as undefined');
}
this.partials[name] = partial;
function HandlebarsEnvironment(helpers, partials) {
this.helpers = helpers || {};
this.partials = partials || {};
registerDefaultHelpers(this);
}
HandlebarsEnvironment.prototype = {
constructor: HandlebarsEnvironment,
logger: logger,
log: log,
registerHelper: function registerHelper(name, fn) {
if (toString.call(name) === objectType) {
if (fn) {
throw new _Exception('Arg not supported with multiple helpers');
}
},
unregisterPartial: function(name) {
delete this.partials[name];
_utils.extend(this.helpers, name);
} else {
this.helpers[name] = fn;
}
};
},
unregisterHelper: function unregisterHelper(name) {
delete this.helpers[name];
},
function registerDefaultHelpers(instance) {
instance.registerHelper('helperMissing', function(/* [args, ]options */) {
if(arguments.length === 1) {
// A missing field in a {{foo}} constuct.
return undefined;
} else {
// Someone is actually trying to call something, blow up.
throw new Exception("Missing helper: '" + arguments[arguments.length-1].name + "'");
registerPartial: function registerPartial(name, partial) {
if (toString.call(name) === objectType) {
_utils.extend(this.partials, name);
} else {
if (typeof partial === 'undefined') {
throw new _Exception('Attempting to register a partial as undefined');
}
});
this.partials[name] = partial;
}
},
unregisterPartial: function unregisterPartial(name) {
delete this.partials[name];
}
};
instance.registerHelper('blockHelperMissing', function(context, options) {
var inverse = options.inverse,
fn = options.fn;
function registerDefaultHelpers(instance) {
instance.registerHelper('helperMissing', function () {
if (arguments.length === 1) {
// A missing field in a {{foo}} constuct.
return undefined;
} else {
// Someone is actually trying to call something, blow up.
throw new _Exception('Missing helper: "' + arguments[arguments.length - 1].name + '"');
}
});
if(context === true) {
return fn(this);
} else if(context === false || context == null) {
return inverse(this);
} else if (isArray(context)) {
if(context.length > 0) {
if (options.ids) {
options.ids = [options.name];
}
instance.registerHelper('blockHelperMissing', function (context, options) {
var inverse = options.inverse,
fn = options.fn;
return instance.helpers.each(context, options);
} else {
return inverse(this);
if (context === true) {
return fn(this);
} else if (context === false || context == null) {
return inverse(this);
} else if (isArray(context)) {
if (context.length > 0) {
if (options.ids) {
options.ids = [options.name];
}
return instance.helpers.each(context, options);
} else {
if (options.data && options.ids) {
var data = createFrame(options.data);
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name);
options = {data: data};
}
return fn(context, options);
return inverse(this);
}
});
instance.registerHelper('each', function(context, options) {
if (!options) {
throw new Exception('Must pass iterator to #each');
} else {
if (options.data && options.ids) {
var data = createFrame(options.data);
data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name);
options = { data: data };
}
var fn = options.fn, inverse = options.inverse;
var i = 0, ret = "", data;
return fn(context, options);
}
});
var contextPath;
if (options.data && options.ids) {
contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';
}
instance.registerHelper('each', function (context, options) {
if (!options) {
throw new _Exception('Must pass iterator to #each');
}
if (isFunction(context)) { context = context.call(this); }
var fn = options.fn,
inverse = options.inverse,
i = 0,
ret = '',
data = undefined,
contextPath = undefined;
if (options.data) {
data = createFrame(options.data);
}
if (options.data && options.ids) {
contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';
}
function execIteration(key, i, last) {
if (data) {
data.key = key;
data.index = i;
data.first = i === 0;
data.last = !!last;
if (isFunction(context)) {
context = context.call(this);
}
if (contextPath) {
data.contextPath = contextPath + key;
}
if (options.data) {
data = createFrame(options.data);
}
function execIteration(field, index, last) {
if (data) {
data.key = field;
data.index = index;
data.first = index === 0;
data.last = !!last;
if (contextPath) {
data.contextPath = contextPath + field;
}
ret = ret + fn(context[key], {
data: data,
blockParams: Utils.blockParams([context[key], key], [contextPath + key, null])
});
}
if(context && typeof context === 'object') {
if (isArray(context)) {
for(var j = context.length; i<j; i++) {
execIteration(i, i, i === context.length-1);
}
} else {
var priorKey;
ret = ret + fn(context[field], {
data: data,
blockParams: _utils.blockParams([context[field], field], [contextPath + field, null])
});
}
for(var key in context) {
if(context.hasOwnProperty(key)) {
// We're running the iterations one step out of sync so we can detect
// the last iteration without have to scan the object twice and create
// an itermediate keys array.
if (priorKey) {
execIteration(priorKey, i-1);
}
priorKey = key;
i++;
if (context && typeof context === 'object') {
if (isArray(context)) {
for (var j = context.length; i < j; i++) {
execIteration(i, i, i === context.length - 1);
}
} else {
var priorKey = undefined;
for (var key in context) {
if (context.hasOwnProperty(key)) {
// We're running the iterations one step out of sync so we can detect
// the last iteration without have to scan the object twice and create
// an itermediate keys array.
if (priorKey) {
execIteration(priorKey, i - 1);
}
priorKey = key;
i++;
}
if (priorKey) {
execIteration(priorKey, i-1, true);
}
}
if (priorKey) {
execIteration(priorKey, i - 1, true);
}
}
}
if(i === 0){
ret = inverse(this);
}
if (i === 0) {
ret = inverse(this);
}
return ret;
});
return ret;
});
instance.registerHelper('if', function(conditional, options) {
if (isFunction(conditional)) { conditional = conditional.call(this); }
instance.registerHelper('if', function (conditional, options) {
if (isFunction(conditional)) {
conditional = conditional.call(this);
}
// Default behavior is to render the positive path if the value is truthy and not empty.
// The `includeZero` option may be set to treat the condtional as purely not empty based on the
// behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
if ((!options.hash.includeZero && !conditional) || Utils.isEmpty(conditional)) {
return options.inverse(this);
} else {
return options.fn(this);
// Default behavior is to render the positive path if the value is truthy and not empty.
// The `includeZero` option may be set to treat the condtional as purely not empty based on the
// behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) {
return options.inverse(this);
} else {
return options.fn(this);
}
});
instance.registerHelper('unless', function (conditional, options) {
return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash });
});
instance.registerHelper('with', function (context, options) {
if (isFunction(context)) {
context = context.call(this);
}
var fn = options.fn;
if (!_utils.isEmpty(context)) {
if (options.data && options.ids) {
var data = createFrame(options.data);
data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]);
options = { data: data };
}
});
instance.registerHelper('unless', function(conditional, options) {
return instance.helpers['if'].call(this, conditional, {fn: options.inverse, inverse: options.fn, hash: options.hash});
});
return fn(context, options);
} else {
return options.inverse(this);
}
});
instance.registerHelper('with', function(context, options) {
if (isFunction(context)) { context = context.call(this); }
instance.registerHelper('log', function (message, options) {
var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
instance.log(level, message);
});
var fn = options.fn;
instance.registerHelper('lookup', function (obj, field) {
return obj && obj[field];
});
}
if (!Utils.isEmpty(context)) {
if (options.data && options.ids) {
var data = createFrame(options.data);
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]);
options = {data:data};
}
var logger = {
methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' },
return fn(context, options);
} else {
return options.inverse(this);
}
});
// State enum
DEBUG: 0,
INFO: 1,
WARN: 2,
ERROR: 3,
level: 1,
instance.registerHelper('log', function(message, options) {
var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
instance.log(level, message);
});
instance.registerHelper('lookup', function(obj, field) {
return obj && obj[field];
});
// Can be overridden in the host environment
log: function log(level, message) {
if (typeof console !== 'undefined' && logger.level <= level) {
var method = logger.methodMap[level];
(console[method] || console.log).call(console, message); // eslint-disable-line no-console
}
}
};
var logger = {
methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' },
exports.logger = logger;
var log = logger.log;
// State enum
DEBUG: 0,
INFO: 1,
WARN: 2,
ERROR: 3,
level: 1,
exports.log = log;
// Can be overridden in the host environment
log: function(level, message) {
if (typeof console !== 'undefined' && logger.level <= level) {
var method = logger.methodMap[level];
(console[method] || console.log).call(console, message);
}
}
};
__exports__.logger = logger;
var log = logger.log;
__exports__.log = log;
var createFrame = function(object) {
var frame = Utils.extend({}, object);
frame._parent = object;
return frame;
};
__exports__.createFrame = createFrame;
});
function createFrame(object) {
var frame = _utils.extend({}, object);
frame._parent = object;
return frame;
}
});
/* [args, ]options */

@@ -1,146 +0,152 @@

define(
["exports"],
function(__exports__) {
"use strict";
var AST = {
Program: function(statements, blockParams, strip, locInfo) {
this.loc = locInfo;
this.type = 'Program';
this.body = statements;
define(['exports', 'module'], function (exports, module) {
'use strict';
this.blockParams = blockParams;
this.strip = strip;
},
var AST = {
Program: function Program(statements, blockParams, strip, locInfo) {
this.loc = locInfo;
this.type = 'Program';
this.body = statements;
MustacheStatement: function(path, params, hash, escaped, strip, locInfo) {
this.loc = locInfo;
this.type = 'MustacheStatement';
this.blockParams = blockParams;
this.strip = strip;
},
this.path = path;
this.params = params || [];
this.hash = hash;
this.escaped = escaped;
MustacheStatement: function MustacheStatement(path, params, hash, escaped, strip, locInfo) {
this.loc = locInfo;
this.type = 'MustacheStatement';
this.strip = strip;
},
this.path = path;
this.params = params || [];
this.hash = hash;
this.escaped = escaped;
BlockStatement: function(path, params, hash, program, inverse, openStrip, inverseStrip, closeStrip, locInfo) {
this.loc = locInfo;
this.type = 'BlockStatement';
this.strip = strip;
},
this.path = path;
this.params = params || [];
this.hash = hash;
this.program = program;
this.inverse = inverse;
BlockStatement: function BlockStatement(path, params, hash, program, inverse, openStrip, inverseStrip, closeStrip, locInfo) {
this.loc = locInfo;
this.type = 'BlockStatement';
this.openStrip = openStrip;
this.inverseStrip = inverseStrip;
this.closeStrip = closeStrip;
},
this.path = path;
this.params = params || [];
this.hash = hash;
this.program = program;
this.inverse = inverse;
PartialStatement: function(name, params, hash, strip, locInfo) {
this.loc = locInfo;
this.type = 'PartialStatement';
this.openStrip = openStrip;
this.inverseStrip = inverseStrip;
this.closeStrip = closeStrip;
},
this.name = name;
this.params = params || [];
this.hash = hash;
PartialStatement: function PartialStatement(name, params, hash, strip, locInfo) {
this.loc = locInfo;
this.type = 'PartialStatement';
this.indent = '';
this.strip = strip;
},
this.name = name;
this.params = params || [];
this.hash = hash;
ContentStatement: function(string, locInfo) {
this.loc = locInfo;
this.type = 'ContentStatement';
this.original = this.value = string;
},
this.indent = '';
this.strip = strip;
},
CommentStatement: function(comment, strip, locInfo) {
this.loc = locInfo;
this.type = 'CommentStatement';
this.value = comment;
ContentStatement: function ContentStatement(string, locInfo) {
this.loc = locInfo;
this.type = 'ContentStatement';
this.original = this.value = string;
},
this.strip = strip;
},
CommentStatement: function CommentStatement(comment, strip, locInfo) {
this.loc = locInfo;
this.type = 'CommentStatement';
this.value = comment;
SubExpression: function(path, params, hash, locInfo) {
this.loc = locInfo;
this.strip = strip;
},
this.type = 'SubExpression';
this.path = path;
this.params = params || [];
this.hash = hash;
},
SubExpression: function SubExpression(path, params, hash, locInfo) {
this.loc = locInfo;
PathExpression: function(data, depth, parts, original, locInfo) {
this.loc = locInfo;
this.type = 'PathExpression';
this.type = 'SubExpression';
this.path = path;
this.params = params || [];
this.hash = hash;
},
this.data = data;
this.original = original;
this.parts = parts;
this.depth = depth;
},
PathExpression: function PathExpression(data, depth, parts, original, locInfo) {
this.loc = locInfo;
this.type = 'PathExpression';
StringLiteral: function(string, locInfo) {
this.loc = locInfo;
this.type = 'StringLiteral';
this.original =
this.value = string;
},
this.data = data;
this.original = original;
this.parts = parts;
this.depth = depth;
},
NumberLiteral: function(number, locInfo) {
this.loc = locInfo;
this.type = 'NumberLiteral';
this.original =
this.value = Number(number);
},
StringLiteral: function StringLiteral(string, locInfo) {
this.loc = locInfo;
this.type = 'StringLiteral';
this.original = this.value = string;
},
BooleanLiteral: function(bool, locInfo) {
this.loc = locInfo;
this.type = 'BooleanLiteral';
this.original =
this.value = bool === 'true';
NumberLiteral: function NumberLiteral(number, locInfo) {
this.loc = locInfo;
this.type = 'NumberLiteral';
this.original = this.value = Number(number);
},
BooleanLiteral: function BooleanLiteral(bool, locInfo) {
this.loc = locInfo;
this.type = 'BooleanLiteral';
this.original = this.value = bool === 'true';
},
UndefinedLiteral: function UndefinedLiteral(locInfo) {
this.loc = locInfo;
this.type = 'UndefinedLiteral';
this.original = this.value = undefined;
},
NullLiteral: function NullLiteral(locInfo) {
this.loc = locInfo;
this.type = 'NullLiteral';
this.original = this.value = null;
},
Hash: function Hash(pairs, locInfo) {
this.loc = locInfo;
this.type = 'Hash';
this.pairs = pairs;
},
HashPair: function HashPair(key, value, locInfo) {
this.loc = locInfo;
this.type = 'HashPair';
this.key = key;
this.value = value;
},
// Public API used to evaluate derived attributes regarding AST nodes
helpers: {
// a mustache is definitely a helper if:
// * it is an eligible helper, and
// * it has at least one parameter or hash segment
helperExpression: function helperExpression(node) {
return !!(node.type === 'SubExpression' || node.params.length || node.hash);
},
Hash: function(pairs, locInfo) {
this.loc = locInfo;
this.type = 'Hash';
this.pairs = pairs;
scopedId: function scopedId(path) {
return /^\.|this\b/.test(path.original);
},
HashPair: function(key, value, locInfo) {
this.loc = locInfo;
this.type = 'HashPair';
this.key = key;
this.value = value;
},
// Public API used to evaluate derived attributes regarding AST nodes
helpers: {
// a mustache is definitely a helper if:
// * it is an eligible helper, and
// * it has at least one parameter or hash segment
// TODO: Make these public utility methods
helperExpression: function(node) {
return !!(node.type === 'SubExpression' || node.params.length || node.hash);
},
scopedId: function(path) {
return (/^\.|this\b/).test(path.original);
},
// an ID is simple if it only has one part, and that part is not
// `..` or `this`.
simpleId: function(path) {
return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth;
}
// an ID is simple if it only has one part, and that part is not
// `..` or `this`.
simpleId: function simpleId(path) {
return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth;
}
};
}
};
// Must be exported as an object rather than the root of the module as the jison lexer
// must modify the object to operate properly.
__exports__["default"] = AST;
});
// Must be exported as an object rather than the root of the module as the jison lexer
// must modify the object to operate properly.
module.exports = AST;
});

@@ -1,32 +0,36 @@

define(
["./parser","./ast","./whitespace-control","./helpers","../utils","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __exports__) {
"use strict";
var parser = __dependency1__["default"];
var AST = __dependency2__["default"];
var WhitespaceControl = __dependency3__["default"];
var Helpers = __dependency4__;
var extend = __dependency5__.extend;
define(['exports', './parser', './ast', './whitespace-control', './helpers', '../utils'], function (exports, _parser, _ast, _whitespaceControl, _helpers, _utils) {
'use strict';
__exports__.parser = parser;
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj['default'] : obj; };
var yy = {};
extend(yy, Helpers, AST);
exports.__esModule = true;
exports.parse = parse;
function parse(input, options) {
// Just return if an already-compiled AST was passed in.
if (input.type === 'Program') { return input; }
var _parser2 = _interopRequire(_parser);
parser.yy = yy;
var _AST = _interopRequire(_ast);
// Altering the shared object here, but this is ok as parser is a sync operation
yy.locInfo = function(locInfo) {
return new yy.SourceLocation(options && options.srcName, locInfo);
};
var _WhitespaceControl = _interopRequire(_whitespaceControl);
var strip = new WhitespaceControl();
return strip.accept(parser.parse(input));
exports.parser = _parser2;
var yy = {};
_utils.extend(yy, _helpers, _AST);
function parse(input, options) {
// Just return if an already-compiled AST was passed in.
if (input.type === 'Program') {
return input;
}
__exports__.parse = parse;
});
_parser2.yy = yy;
// Altering the shared object here, but this is ok as parser is a sync operation
yy.locInfo = function (locInfo) {
return new yy.SourceLocation(options && options.srcName, locInfo);
};
var strip = new _WhitespaceControl();
return strip.accept(_parser2.parse(input));
}
});

@@ -1,158 +0,161 @@

define(
["../utils","exports"],
function(__dependency1__, __exports__) {
"use strict";
var isArray = __dependency1__.isArray;
define(['exports', 'module', '../utils'], function (exports, module, _utils) {
'use strict';
try {
var SourceMap = require('source-map'),
SourceNode = SourceMap.SourceNode;
} catch (err) {
/* istanbul ignore next: tested but not covered in istanbul due to dist build */
SourceNode = function(line, column, srcFile, chunks) {
this.src = '';
if (chunks) {
this.add(chunks);
var SourceNode = undefined;
try {
/* istanbul ignore next */
if (typeof define !== 'function' || !define.amd) {
// We don't support this in AMD environments. For these environments, we asusme that
// they are running on the browser and thus have no need for the source-map library.
var SourceMap = require('source-map');
SourceNode = SourceMap.SourceNode;
}
} catch (err) {}
/* istanbul ignore if: tested but not covered in istanbul due to dist build */
if (!SourceNode) {
SourceNode = function (line, column, srcFile, chunks) {
this.src = '';
if (chunks) {
this.add(chunks);
}
};
/* istanbul ignore next */
SourceNode.prototype = {
add: function add(chunks) {
if (_utils.isArray(chunks)) {
chunks = chunks.join('');
}
};
/* istanbul ignore next */
SourceNode.prototype = {
add: function(chunks) {
if (isArray(chunks)) {
chunks = chunks.join('');
}
this.src += chunks;
},
prepend: function(chunks) {
if (isArray(chunks)) {
chunks = chunks.join('');
}
this.src = chunks + this.src;
},
toStringWithSourceMap: function() {
return {code: this.toString()};
},
toString: function() {
return this.src;
this.src += chunks;
},
prepend: function prepend(chunks) {
if (_utils.isArray(chunks)) {
chunks = chunks.join('');
}
};
}
this.src = chunks + this.src;
},
toStringWithSourceMap: function toStringWithSourceMap() {
return { code: this.toString() };
},
toString: function toString() {
return this.src;
}
};
}
function castChunk(chunk, codeGen, loc) {
if (_utils.isArray(chunk)) {
var ret = [];
function castChunk(chunk, codeGen, loc) {
if (isArray(chunk)) {
var ret = [];
for (var i = 0, len = chunk.length; i < len; i++) {
ret.push(codeGen.wrap(chunk[i], loc));
}
return ret;
} else if (typeof chunk === 'boolean' || typeof chunk === 'number') {
// Handle primitives that the SourceNode will throw up on
return chunk+'';
for (var i = 0, len = chunk.length; i < len; i++) {
ret.push(codeGen.wrap(chunk[i], loc));
}
return chunk;
return ret;
} else if (typeof chunk === 'boolean' || typeof chunk === 'number') {
// Handle primitives that the SourceNode will throw up on
return chunk + '';
}
return chunk;
}
function CodeGen(srcFile) {
this.srcFile = srcFile;
this.source = [];
}
function CodeGen(srcFile) {
this.srcFile = srcFile;
this.source = [];
}
CodeGen.prototype = {
prepend: function prepend(source, loc) {
this.source.unshift(this.wrap(source, loc));
},
push: function push(source, loc) {
this.source.push(this.wrap(source, loc));
},
CodeGen.prototype = {
prepend: function(source, loc) {
this.source.unshift(this.wrap(source, loc));
},
push: function(source, loc) {
this.source.push(this.wrap(source, loc));
},
merge: function merge() {
var source = this.empty();
this.each(function (line) {
source.add([' ', line, '\n']);
});
return source;
},
merge: function() {
var source = this.empty();
this.each(function(line) {
source.add([' ', line, '\n']);
});
return source;
},
each: function each(iter) {
for (var i = 0, len = this.source.length; i < len; i++) {
iter(this.source[i]);
}
},
each: function(iter) {
for (var i = 0, len = this.source.length; i < len; i++) {
iter(this.source[i]);
}
},
empty: function empty() {
var loc = arguments[0] === undefined ? this.currentLocation || { start: {} } : arguments[0];
empty: function(loc) {
loc = loc || this.currentLocation || {start:{}};
return new SourceNode(loc.start.line, loc.start.column, this.srcFile);
},
wrap: function(chunk, loc) {
if (chunk instanceof SourceNode) {
return chunk;
}
return new SourceNode(loc.start.line, loc.start.column, this.srcFile);
},
wrap: function wrap(chunk) {
var loc = arguments[1] === undefined ? this.currentLocation || { start: {} } : arguments[1];
loc = loc || this.currentLocation || {start:{}};
chunk = castChunk(chunk, this, loc);
if (chunk instanceof SourceNode) {
return chunk;
}
return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk);
},
chunk = castChunk(chunk, this, loc);
functionCall: function(fn, type, params) {
params = this.generateList(params);
return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']);
},
return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk);
},
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') + '"';
},
functionCall: function functionCall(fn, type, params) {
params = this.generateList(params);
return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']);
},
objectLiteral: function(obj) {
var pairs = [];
quotedString: function quotedString(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') + '"';
},
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
var value = castChunk(obj[key], this);
if (value !== 'undefined') {
pairs.push([this.quotedString(key), ':', value]);
}
objectLiteral: function objectLiteral(obj) {
var pairs = [];
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
var value = castChunk(obj[key], this);
if (value !== 'undefined') {
pairs.push([this.quotedString(key), ':', value]);
}
}
}
var ret = this.generateList(pairs);
ret.prepend('{');
ret.add('}');
return ret;
},
var ret = this.generateList(pairs);
ret.prepend('{');
ret.add('}');
return ret;
},
generateList: function generateList(entries, loc) {
var ret = this.empty(loc);
generateList: function(entries, loc) {
var ret = this.empty(loc);
for (var i = 0, len = entries.length; i < len; i++) {
if (i) {
ret.add(',');
}
for (var i = 0, len = entries.length; i < len; i++) {
if (i) {
ret.add(',');
}
ret.add(castChunk(entries[i], this, loc));
}
ret.add(castChunk(entries[i], this, loc));
}
return ret;
},
return ret;
},
generateArray: function generateArray(entries, loc) {
var ret = this.generateList(entries, loc);
ret.prepend('[');
ret.add(']');
generateArray: function(entries, loc) {
var ret = this.generateList(entries, loc);
ret.prepend('[');
ret.add(']');
return ret;
}
};
return ret;
}
};
module.exports = CodeGen;
});
/*global define */
__exports__["default"] = CodeGen;
});
/* NOP */

@@ -1,505 +0,523 @@

define(
["../exception","../utils","./ast","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
"use strict";
var Exception = __dependency1__["default"];
var isArray = __dependency2__.isArray;
var indexOf = __dependency2__.indexOf;
var AST = __dependency3__["default"];
define(['exports', '../exception', '../utils', './ast'], function (exports, _exception, _utils, _ast) {
'use strict';
var slice = [].slice;
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj['default'] : obj; };
exports.__esModule = true;
exports.Compiler = Compiler;
exports.precompile = precompile;
exports.compile = compile;
function Compiler() {}
var _Exception = _interopRequire(_exception);
__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.
var _AST = _interopRequire(_ast);
Compiler.prototype = {
compiler: Compiler,
var slice = [].slice;
equals: function(other) {
var len = this.opcodes.length;
if (other.opcodes.length !== len) {
function 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,
equals: function equals(other) {
var len = this.opcodes.length;
if (other.opcodes.length !== len) {
return false;
}
for (var i = 0; i < len; i++) {
var opcode = this.opcodes[i],
otherOpcode = other.opcodes[i];
if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) {
return false;
}
}
for (var i = 0; i < len; i++) {
var opcode = this.opcodes[i],
otherOpcode = other.opcodes[i];
if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) {
return false;
}
// We know that length is the same between the two arrays because they are directly tied
// to the opcode behavior above.
len = this.children.length;
for (var i = 0; i < len; i++) {
if (!this.children[i].equals(other.children[i])) {
return false;
}
}
// We know that length is the same between the two arrays because they are directly tied
// to the opcode behavior above.
len = this.children.length;
for (i = 0; i < len; i++) {
if (!this.children[i].equals(other.children[i])) {
return false;
}
}
return true;
},
return true;
},
guid: 0,
guid: 0,
compile: function compile(program, options) {
this.sourceNode = [];
this.opcodes = [];
this.children = [];
this.options = options;
this.stringParams = options.stringParams;
this.trackIds = options.trackIds;
compile: function(program, options) {
this.sourceNode = [];
this.opcodes = [];
this.children = [];
this.options = options;
this.stringParams = options.stringParams;
this.trackIds = options.trackIds;
options.blockParams = options.blockParams || [];
options.blockParams = options.blockParams || [];
// These changes will propagate to the other compiler components
var knownHelpers = options.knownHelpers;
options.knownHelpers = {
'helperMissing': true,
'blockHelperMissing': true,
'each': true,
'if': true,
'unless': true,
'with': true,
'log': true,
'lookup': true
};
if (knownHelpers) {
for (var name in knownHelpers) {
options.knownHelpers[name] = knownHelpers[name];
// These changes will propagate to the other compiler components
var knownHelpers = options.knownHelpers;
options.knownHelpers = {
helperMissing: true,
blockHelperMissing: true,
each: true,
'if': true,
unless: true,
'with': true,
log: true,
lookup: true
};
if (knownHelpers) {
for (var _name in knownHelpers) {
if (_name in knownHelpers) {
options.knownHelpers[_name] = knownHelpers[_name];
}
}
}
return this.accept(program);
},
return this.accept(program);
},
compileProgram: function(program) {
var result = new this.compiler().compile(program, this.options);
var guid = this.guid++;
compileProgram: function compileProgram(program) {
var childCompiler = new this.compiler(),
// eslint-disable-line new-cap
result = childCompiler.compile(program, this.options),
guid = this.guid++;
this.usePartial = this.usePartial || result.usePartial;
this.usePartial = this.usePartial || result.usePartial;
this.children[guid] = result;
this.useDepths = this.useDepths || result.useDepths;
this.children[guid] = result;
this.useDepths = this.useDepths || result.useDepths;
return guid;
},
return guid;
},
accept: function(node) {
this.sourceNode.unshift(node);
var ret = this[node.type](node);
this.sourceNode.shift();
return ret;
},
accept: function accept(node) {
this.sourceNode.unshift(node);
var ret = this[node.type](node);
this.sourceNode.shift();
return ret;
},
Program: function(program) {
this.options.blockParams.unshift(program.blockParams);
Program: function Program(program) {
this.options.blockParams.unshift(program.blockParams);
var body = program.body;
for(var i=0, l=body.length; i<l; i++) {
this.accept(body[i]);
}
var body = program.body,
bodyLength = body.length;
for (var i = 0; i < bodyLength; i++) {
this.accept(body[i]);
}
this.options.blockParams.shift();
this.options.blockParams.shift();
this.isSimple = l === 1;
this.blockParams = program.blockParams ? program.blockParams.length : 0;
this.isSimple = bodyLength === 1;
this.blockParams = program.blockParams ? program.blockParams.length : 0;
return this;
},
return this;
},
BlockStatement: function(block) {
transformLiteralToPath(block);
BlockStatement: function BlockStatement(block) {
transformLiteralToPath(block);
var program = block.program,
inverse = block.inverse;
var program = block.program,
inverse = block.inverse;
program = program && this.compileProgram(program);
inverse = inverse && this.compileProgram(inverse);
program = program && this.compileProgram(program);
inverse = inverse && this.compileProgram(inverse);
var type = this.classifySexpr(block);
var type = this.classifySexpr(block);
if (type === 'helper') {
this.helperSexpr(block, program, inverse);
} else if (type === 'simple') {
this.simpleSexpr(block);
if (type === 'helper') {
this.helperSexpr(block, program, inverse);
} else if (type === 'simple') {
this.simpleSexpr(block);
// now that the simple mustache is resolved, we need to
// evaluate it by executing `blockHelperMissing`
this.opcode('pushProgram', program);
this.opcode('pushProgram', inverse);
this.opcode('emptyHash');
this.opcode('blockValue', block.path.original);
} else {
this.ambiguousSexpr(block, program, inverse);
// now that the simple mustache is resolved, we need to
// evaluate it by executing `blockHelperMissing`
this.opcode('pushProgram', program);
this.opcode('pushProgram', inverse);
this.opcode('emptyHash');
this.opcode('blockValue', block.path.original);
} else {
this.ambiguousSexpr(block, program, inverse);
// now that the simple mustache is resolved, we need to
// evaluate it by executing `blockHelperMissing`
this.opcode('pushProgram', program);
this.opcode('pushProgram', inverse);
this.opcode('emptyHash');
this.opcode('ambiguousBlockValue');
}
// now that the simple mustache is resolved, we need to
// evaluate it by executing `blockHelperMissing`
this.opcode('pushProgram', program);
this.opcode('pushProgram', inverse);
this.opcode('emptyHash');
this.opcode('ambiguousBlockValue');
}
this.opcode('append');
},
this.opcode('append');
},
PartialStatement: function(partial) {
this.usePartial = true;
PartialStatement: function PartialStatement(partial) {
this.usePartial = true;
var params = partial.params;
if (params.length > 1) {
throw new Exception('Unsupported number of partial arguments: ' + params.length, partial);
} else if (!params.length) {
params.push({type: 'PathExpression', parts: [], depth: 0});
}
var params = partial.params;
if (params.length > 1) {
throw new _Exception('Unsupported number of partial arguments: ' + params.length, partial);
} else if (!params.length) {
params.push({ type: 'PathExpression', parts: [], depth: 0 });
}
var partialName = partial.name.original,
isDynamic = partial.name.type === 'SubExpression';
if (isDynamic) {
this.accept(partial.name);
}
var partialName = partial.name.original,
isDynamic = partial.name.type === 'SubExpression';
if (isDynamic) {
this.accept(partial.name);
}
this.setupFullMustacheParams(partial, undefined, undefined, true);
this.setupFullMustacheParams(partial, undefined, undefined, true);
var indent = partial.indent || '';
if (this.options.preventIndent && indent) {
this.opcode('appendContent', indent);
indent = '';
}
var indent = partial.indent || '';
if (this.options.preventIndent && indent) {
this.opcode('appendContent', indent);
indent = '';
}
this.opcode('invokePartial', isDynamic, partialName, indent);
this.opcode('invokePartial', isDynamic, partialName, indent);
this.opcode('append');
},
MustacheStatement: function MustacheStatement(mustache) {
this.SubExpression(mustache); // eslint-disable-line new-cap
if (mustache.escaped && !this.options.noEscape) {
this.opcode('appendEscaped');
} else {
this.opcode('append');
},
}
},
MustacheStatement: function(mustache) {
this.SubExpression(mustache);
ContentStatement: function ContentStatement(content) {
if (content.value) {
this.opcode('appendContent', content.value);
}
},
if(mustache.escaped && !this.options.noEscape) {
this.opcode('appendEscaped');
} else {
this.opcode('append');
}
},
CommentStatement: function CommentStatement() {},
ContentStatement: function(content) {
if (content.value) {
this.opcode('appendContent', content.value);
}
},
SubExpression: function SubExpression(sexpr) {
transformLiteralToPath(sexpr);
var type = this.classifySexpr(sexpr);
CommentStatement: function() {},
if (type === 'simple') {
this.simpleSexpr(sexpr);
} else if (type === 'helper') {
this.helperSexpr(sexpr);
} else {
this.ambiguousSexpr(sexpr);
}
},
ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) {
var path = sexpr.path,
name = path.parts[0],
isBlock = program != null || inverse != null;
SubExpression: function(sexpr) {
transformLiteralToPath(sexpr);
var type = this.classifySexpr(sexpr);
this.opcode('getContext', path.depth);
if (type === 'simple') {
this.simpleSexpr(sexpr);
} else if (type === 'helper') {
this.helperSexpr(sexpr);
} else {
this.ambiguousSexpr(sexpr);
}
},
ambiguousSexpr: function(sexpr, program, inverse) {
var path = sexpr.path,
name = path.parts[0],
isBlock = program != null || inverse != null;
this.opcode('pushProgram', program);
this.opcode('pushProgram', inverse);
this.opcode('getContext', path.depth);
this.accept(path);
this.opcode('pushProgram', program);
this.opcode('pushProgram', inverse);
this.opcode('invokeAmbiguous', name, isBlock);
},
this.accept(path);
simpleSexpr: function simpleSexpr(sexpr) {
this.accept(sexpr.path);
this.opcode('resolvePossibleLambda');
},
this.opcode('invokeAmbiguous', name, isBlock);
},
helperSexpr: function helperSexpr(sexpr, program, inverse) {
var params = this.setupFullMustacheParams(sexpr, program, inverse),
path = sexpr.path,
name = path.parts[0];
simpleSexpr: function(sexpr) {
this.accept(sexpr.path);
this.opcode('resolvePossibleLambda');
},
if (this.options.knownHelpers[name]) {
this.opcode('invokeKnownHelper', params.length, name);
} else if (this.options.knownHelpersOnly) {
throw new _Exception('You specified knownHelpersOnly, but used the unknown helper ' + name, sexpr);
} else {
path.falsy = true;
helperSexpr: function(sexpr, program, inverse) {
var params = this.setupFullMustacheParams(sexpr, program, inverse),
path = sexpr.path,
name = path.parts[0];
this.accept(path);
this.opcode('invokeHelper', params.length, path.original, _AST.helpers.simpleId(path));
}
},
if (this.options.knownHelpers[name]) {
this.opcode('invokeKnownHelper', params.length, name);
} else if (this.options.knownHelpersOnly) {
throw new Exception("You specified knownHelpersOnly, but used the unknown helper " + name, sexpr);
} else {
path.falsy = true;
PathExpression: function PathExpression(path) {
this.addDepth(path.depth);
this.opcode('getContext', path.depth);
this.accept(path);
this.opcode('invokeHelper', params.length, path.original, AST.helpers.simpleId(path));
}
},
var name = path.parts[0],
scoped = _AST.helpers.scopedId(path),
blockParamId = !path.depth && !scoped && this.blockParamIndex(name);
PathExpression: function(path) {
this.addDepth(path.depth);
this.opcode('getContext', path.depth);
if (blockParamId) {
this.opcode('lookupBlockParam', blockParamId, path.parts);
} else if (!name) {
// Context reference, i.e. `{{foo .}}` or `{{foo ..}}`
this.opcode('pushContext');
} else if (path.data) {
this.options.data = true;
this.opcode('lookupData', path.depth, path.parts);
} else {
this.opcode('lookupOnContext', path.parts, path.falsy, scoped);
}
},
var name = path.parts[0],
scoped = AST.helpers.scopedId(path),
blockParamId = !path.depth && !scoped && this.blockParamIndex(name);
StringLiteral: function StringLiteral(string) {
this.opcode('pushString', string.value);
},
if (blockParamId) {
this.opcode('lookupBlockParam', blockParamId, path.parts);
} else if (!name) {
// Context reference, i.e. `{{foo .}}` or `{{foo ..}}`
this.opcode('pushContext');
} else if (path.data) {
this.options.data = true;
this.opcode('lookupData', path.depth, path.parts);
} else {
this.opcode('lookupOnContext', path.parts, path.falsy, scoped);
}
},
NumberLiteral: function NumberLiteral(number) {
this.opcode('pushLiteral', number.value);
},
StringLiteral: function(string) {
this.opcode('pushString', string.value);
},
BooleanLiteral: function BooleanLiteral(bool) {
this.opcode('pushLiteral', bool.value);
},
NumberLiteral: function(number) {
this.opcode('pushLiteral', number.value);
},
UndefinedLiteral: function UndefinedLiteral() {
this.opcode('pushLiteral', 'undefined');
},
BooleanLiteral: function(bool) {
this.opcode('pushLiteral', bool.value);
},
NullLiteral: function NullLiteral() {
this.opcode('pushLiteral', 'null');
},
Hash: function(hash) {
var pairs = hash.pairs, i, l;
Hash: function Hash(hash) {
var pairs = hash.pairs,
i = 0,
l = pairs.length;
this.opcode('pushHash');
this.opcode('pushHash');
for (i=0, l=pairs.length; i<l; i++) {
this.pushParam(pairs[i].value);
}
while (i--) {
this.opcode('assignToHash', pairs[i].key);
}
this.opcode('popHash');
},
for (; i < l; i++) {
this.pushParam(pairs[i].value);
}
while (i--) {
this.opcode('assignToHash', pairs[i].key);
}
this.opcode('popHash');
},
// HELPERS
opcode: function(name) {
this.opcodes.push({ opcode: name, args: slice.call(arguments, 1), loc: this.sourceNode[0].loc });
},
// HELPERS
opcode: function opcode(name) {
this.opcodes.push({ opcode: name, args: slice.call(arguments, 1), loc: this.sourceNode[0].loc });
},
addDepth: function(depth) {
if (!depth) {
return;
}
addDepth: function addDepth(depth) {
if (!depth) {
return;
}
this.useDepths = true;
},
this.useDepths = true;
},
classifySexpr: function(sexpr) {
var isSimple = AST.helpers.simpleId(sexpr.path);
classifySexpr: function classifySexpr(sexpr) {
var isSimple = _AST.helpers.simpleId(sexpr.path);
var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]);
var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]);
// a mustache is an eligible helper if:
// * its id is simple (a single part, not `this` or `..`)
var isHelper = !isBlockParam && AST.helpers.helperExpression(sexpr);
// a mustache is an eligible helper if:
// * its id is simple (a single part, not `this` or `..`)
var isHelper = !isBlockParam && _AST.helpers.helperExpression(sexpr);
// if a mustache is an eligible helper but not a definite
// helper, it is ambiguous, and will be resolved in a later
// pass or at runtime.
var isEligible = !isBlockParam && (isHelper || isSimple);
// if a mustache is an eligible helper but not a definite
// helper, it is ambiguous, and will be resolved in a later
// pass or at runtime.
var isEligible = !isBlockParam && (isHelper || isSimple);
var options = this.options;
// if ambiguous, we can possibly resolve the ambiguity now
// An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc.
if (isEligible && !isHelper) {
var _name2 = sexpr.path.parts[0],
options = this.options;
// if ambiguous, we can possibly resolve the ambiguity now
// An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc.
if (isEligible && !isHelper) {
var name = sexpr.path.parts[0];
if (options.knownHelpers[name]) {
isHelper = true;
} else if (options.knownHelpersOnly) {
isEligible = false;
}
if (options.knownHelpers[_name2]) {
isHelper = true;
} else if (options.knownHelpersOnly) {
isEligible = false;
}
}
if (isHelper) { return 'helper'; }
else if (isEligible) { return 'ambiguous'; }
else { return 'simple'; }
},
if (isHelper) {
return 'helper';
} else if (isEligible) {
return 'ambiguous';
} else {
return 'simple';
}
},
pushParams: function(params) {
for(var i=0, l=params.length; i<l; i++) {
this.pushParam(params[i]);
}
},
pushParams: function pushParams(params) {
for (var i = 0, l = params.length; i < l; i++) {
this.pushParam(params[i]);
}
},
pushParam: function(val) {
var value = val.value != null ? val.value : val.original || '';
pushParam: function pushParam(val) {
var value = val.value != null ? val.value : val.original || '';
if (this.stringParams) {
if (value.replace) {
value = value
.replace(/^(\.?\.\/)*/g, '')
.replace(/\//g, '.');
}
if (this.stringParams) {
if (value.replace) {
value = value.replace(/^(\.?\.\/)*/g, '').replace(/\//g, '.');
}
if(val.depth) {
this.addDepth(val.depth);
}
this.opcode('getContext', val.depth || 0);
this.opcode('pushStringParam', value, val.type);
if (val.depth) {
this.addDepth(val.depth);
}
this.opcode('getContext', val.depth || 0);
this.opcode('pushStringParam', value, val.type);
if (val.type === 'SubExpression') {
// SubExpressions get evaluated and passed in
// in string params mode.
this.accept(val);
if (val.type === 'SubExpression') {
// SubExpressions get evaluated and passed in
// in string params mode.
this.accept(val);
}
} else {
if (this.trackIds) {
var blockParamIndex = undefined;
if (val.parts && !_AST.helpers.scopedId(val) && !val.depth) {
blockParamIndex = this.blockParamIndex(val.parts[0]);
}
} else {
if (this.trackIds) {
var blockParamIndex;
if (val.parts && !AST.helpers.scopedId(val) && !val.depth) {
blockParamIndex = this.blockParamIndex(val.parts[0]);
if (blockParamIndex) {
var blockParamChild = val.parts.slice(1).join('.');
this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild);
} else {
value = val.original || value;
if (value.replace) {
value = value.replace(/^\.\//g, '').replace(/^\.$/g, '');
}
if (blockParamIndex) {
var blockParamChild = val.parts.slice(1).join('.');
this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild);
} else {
value = val.original || value;
if (value.replace) {
value = value
.replace(/^\.\//g, '')
.replace(/^\.$/g, '');
}
this.opcode('pushId', val.type, value);
}
this.opcode('pushId', val.type, value);
}
this.accept(val);
}
},
this.accept(val);
}
},
setupFullMustacheParams: function(sexpr, program, inverse, omitEmpty) {
var params = sexpr.params;
this.pushParams(params);
setupFullMustacheParams: function setupFullMustacheParams(sexpr, program, inverse, omitEmpty) {
var params = sexpr.params;
this.pushParams(params);
this.opcode('pushProgram', program);
this.opcode('pushProgram', inverse);
this.opcode('pushProgram', program);
this.opcode('pushProgram', inverse);
if (sexpr.hash) {
this.accept(sexpr.hash);
} else {
this.opcode('emptyHash', omitEmpty);
}
if (sexpr.hash) {
this.accept(sexpr.hash);
} else {
this.opcode('emptyHash', omitEmpty);
}
return params;
},
return params;
},
blockParamIndex: function(name) {
for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) {
var blockParams = this.options.blockParams[depth],
param = blockParams && indexOf(blockParams, name);
if (blockParams && param >= 0) {
return [depth, param];
}
blockParamIndex: function blockParamIndex(name) {
for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) {
var blockParams = this.options.blockParams[depth],
param = blockParams && _utils.indexOf(blockParams, name);
if (blockParams && param >= 0) {
return [depth, param];
}
}
};
}
};
function precompile(input, options, env) {
if (input == null || (typeof input !== 'string' && input.type !== 'Program')) {
throw new Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed " + input);
}
function precompile(input, options, env) {
if (input == null || typeof input !== 'string' && input.type !== 'Program') {
throw new _Exception('You must pass a string or Handlebars AST to Handlebars.precompile. You passed ' + input);
}
options = options || {};
if (!('data' in options)) {
options.data = true;
}
if (options.compat) {
options.useDepths = true;
}
options = options || {};
if (!('data' in options)) {
options.data = true;
}
if (options.compat) {
options.useDepths = true;
}
var ast = env.parse(input, options);
var environment = new env.Compiler().compile(ast, options);
return new env.JavaScriptCompiler().compile(environment, options);
var ast = env.parse(input, options),
environment = new env.Compiler().compile(ast, options);
return new env.JavaScriptCompiler().compile(environment, options);
}
function compile(input, _x, env) {
var options = arguments[1] === undefined ? {} : arguments[1];
if (input == null || typeof input !== 'string' && input.type !== 'Program') {
throw new _Exception('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input);
}
__exports__.precompile = precompile;function compile(input, options, env) {
if (input == null || (typeof input !== 'string' && input.type !== 'Program')) {
throw new Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input);
}
if (!('data' in options)) {
options.data = true;
}
if (options.compat) {
options.useDepths = true;
}
options = options || {};
var compiled = undefined;
if (!('data' in options)) {
options.data = true;
function compileInput() {
var ast = env.parse(input, options),
environment = new env.Compiler().compile(ast, options),
templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true);
return env.template(templateSpec);
}
// Template is only compiled on first use and cached after that point.
function ret(context, execOptions) {
if (!compiled) {
compiled = compileInput();
}
if (options.compat) {
options.useDepths = true;
return compiled.call(this, context, execOptions);
}
ret._setup = function (setupOptions) {
if (!compiled) {
compiled = compileInput();
}
var compiled;
function compileInput() {
var ast = env.parse(input, options);
var environment = new env.Compiler().compile(ast, options);
var templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true);
return env.template(templateSpec);
return compiled._setup(setupOptions);
};
ret._child = function (i, data, blockParams, depths) {
if (!compiled) {
compiled = compileInput();
}
return compiled._child(i, data, blockParams, depths);
};
return ret;
}
// Template is only compiled on first use and cached after that point.
var ret = function(context, options) {
if (!compiled) {
compiled = compileInput();
}
return compiled.call(this, context, options);
};
ret._setup = function(options) {
if (!compiled) {
compiled = compileInput();
}
return compiled._setup(options);
};
ret._child = function(i, data, blockParams, depths) {
if (!compiled) {
compiled = compileInput();
}
return compiled._child(i, data, blockParams, depths);
};
return ret;
function argEquals(a, b) {
if (a === b) {
return true;
}
__exports__.compile = compile;function argEquals(a, b) {
if (a === b) {
return true;
}
if (isArray(a) && isArray(b) && a.length === b.length) {
for (var i = 0; i < a.length; i++) {
if (!argEquals(a[i], b[i])) {
return false;
}
if (_utils.isArray(a) && _utils.isArray(b) && a.length === b.length) {
for (var i = 0; i < a.length; i++) {
if (!argEquals(a[i], b[i])) {
return false;
}
return true;
}
return true;
}
}
function transformLiteralToPath(sexpr) {
if (!sexpr.path.parts) {
var literal = sexpr.path;
// Casting to string here to make false and 0 literal values play nicely with the rest
// of the system.
sexpr.path = new AST.PathExpression(false, 0, [literal.original+''], literal.original+'', literal.loc);
}
function transformLiteralToPath(sexpr) {
if (!sexpr.path.parts) {
var literal = sexpr.path;
// Casting to string here to make false and 0 literal values play nicely with the rest
// of the system.
sexpr.path = new _AST.PathExpression(false, 0, [literal.original + ''], literal.original + '', literal.loc);
}
});
}
});

@@ -1,123 +0,135 @@

define(
["../exception","exports"],
function(__dependency1__, __exports__) {
"use strict";
var Exception = __dependency1__["default"];
define(['exports', '../exception'], function (exports, _exception) {
'use strict';
function SourceLocation(source, locInfo) {
this.source = source;
this.start = {
line: locInfo.first_line,
column: locInfo.first_column
};
this.end = {
line: locInfo.last_line,
column: locInfo.last_column
};
}
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj['default'] : obj; };
__exports__.SourceLocation = SourceLocation;function stripFlags(open, close) {
return {
open: open.charAt(2) === '~',
close: close.charAt(close.length-3) === '~'
};
}
exports.__esModule = true;
exports.SourceLocation = SourceLocation;
exports.id = id;
exports.stripFlags = stripFlags;
exports.stripComment = stripComment;
exports.preparePath = preparePath;
exports.prepareMustache = prepareMustache;
exports.prepareRawBlock = prepareRawBlock;
exports.prepareBlock = prepareBlock;
__exports__.stripFlags = stripFlags;function stripComment(comment) {
return comment.replace(/^\{\{~?\!-?-?/, '')
.replace(/-?-?~?\}\}$/, '');
var _Exception = _interopRequire(_exception);
function SourceLocation(source, locInfo) {
this.source = source;
this.start = {
line: locInfo.first_line,
column: locInfo.first_column
};
this.end = {
line: locInfo.last_line,
column: locInfo.last_column
};
}
function id(token) {
if (/^\[.*\]$/.test(token)) {
return token.substr(1, token.length - 2);
} else {
return token;
}
}
__exports__.stripComment = stripComment;function preparePath(data, parts, locInfo) {
/*jshint -W040 */
locInfo = this.locInfo(locInfo);
function stripFlags(open, close) {
return {
open: open.charAt(2) === '~',
close: close.charAt(close.length - 3) === '~'
};
}
var original = data ? '@' : '',
dig = [],
depth = 0,
depthString = '';
function stripComment(comment) {
return comment.replace(/^\{\{~?\!-?-?/, '').replace(/-?-?~?\}\}$/, '');
}
for(var i=0,l=parts.length; i<l; i++) {
var part = parts[i].part;
original += (parts[i].separator || '') + part;
function preparePath(data, parts, locInfo) {
/*jshint -W040 */
locInfo = this.locInfo(locInfo);
if (part === '..' || part === '.' || part === 'this') {
if (dig.length > 0) {
throw new Exception('Invalid path: ' + original, {loc: locInfo});
} else if (part === '..') {
depth++;
depthString += '../';
}
} else {
dig.push(part);
var original = data ? '@' : '',
dig = [],
depth = 0,
depthString = '';
for (var i = 0, l = parts.length; i < l; i++) {
var part = parts[i].part,
// If we have [] syntax then we do not treat path references as operators,
// i.e. foo.[this] resolves to approximately context.foo['this']
isLiteral = parts[i].original !== part;
original += (parts[i].separator || '') + part;
if (!isLiteral && (part === '..' || part === '.' || part === 'this')) {
if (dig.length > 0) {
throw new _Exception('Invalid path: ' + original, { loc: locInfo });
} else if (part === '..') {
depth++;
depthString += '../';
}
} else {
dig.push(part);
}
return new this.PathExpression(data, depth, dig, original, locInfo);
}
__exports__.preparePath = preparePath;function prepareMustache(path, params, hash, open, strip, locInfo) {
/*jshint -W040 */
// Must use charAt to support IE pre-10
var escapeFlag = open.charAt(3) || open.charAt(2),
escaped = escapeFlag !== '{' && escapeFlag !== '&';
return new this.PathExpression(data, depth, dig, original, locInfo);
}
return new this.MustacheStatement(path, params, hash, escaped, strip, this.locInfo(locInfo));
}
function prepareMustache(path, params, hash, open, strip, locInfo) {
/*jshint -W040 */
// Must use charAt to support IE pre-10
var escapeFlag = open.charAt(3) || open.charAt(2),
escaped = escapeFlag !== '{' && escapeFlag !== '&';
__exports__.prepareMustache = prepareMustache;function prepareRawBlock(openRawBlock, content, close, locInfo) {
/*jshint -W040 */
if (openRawBlock.path.original !== close) {
var errorNode = {loc: openRawBlock.path.loc};
return new this.MustacheStatement(path, params, hash, escaped, strip, this.locInfo(locInfo));
}
throw new Exception(openRawBlock.path.original + " doesn't match " + close, errorNode);
}
function prepareRawBlock(openRawBlock, content, close, locInfo) {
/*jshint -W040 */
if (openRawBlock.path.original !== close) {
var errorNode = { loc: openRawBlock.path.loc };
locInfo = this.locInfo(locInfo);
var program = new this.Program([content], null, {}, locInfo);
return new this.BlockStatement(
openRawBlock.path, openRawBlock.params, openRawBlock.hash,
program, undefined,
{}, {}, {},
locInfo);
throw new _Exception(openRawBlock.path.original + ' doesn\'t match ' + close, errorNode);
}
__exports__.prepareRawBlock = prepareRawBlock;function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) {
/*jshint -W040 */
// When we are chaining inverse calls, we will not have a close path
if (close && close.path && openBlock.path.original !== close.path.original) {
var errorNode = {loc: openBlock.path.loc};
locInfo = this.locInfo(locInfo);
var program = new this.Program([content], null, {}, locInfo);
throw new Exception(openBlock.path.original + ' doesn\'t match ' + close.path.original, errorNode);
}
return new this.BlockStatement(openRawBlock.path, openRawBlock.params, openRawBlock.hash, program, undefined, {}, {}, {}, locInfo);
}
program.blockParams = openBlock.blockParams;
function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) {
/*jshint -W040 */
// When we are chaining inverse calls, we will not have a close path
if (close && close.path && openBlock.path.original !== close.path.original) {
var errorNode = { loc: openBlock.path.loc };
var inverse,
inverseStrip;
throw new _Exception(openBlock.path.original + ' doesn\'t match ' + close.path.original, errorNode);
}
if (inverseAndProgram) {
if (inverseAndProgram.chain) {
inverseAndProgram.program.body[0].closeStrip = close.strip;
}
program.blockParams = openBlock.blockParams;
inverseStrip = inverseAndProgram.strip;
inverse = inverseAndProgram.program;
}
var inverse = undefined,
inverseStrip = undefined;
if (inverted) {
inverted = inverse;
inverse = program;
program = inverted;
if (inverseAndProgram) {
if (inverseAndProgram.chain) {
inverseAndProgram.program.body[0].closeStrip = close.strip;
}
return new this.BlockStatement(
openBlock.path, openBlock.params, openBlock.hash,
program, inverse,
openBlock.strip, inverseStrip, close && close.strip,
this.locInfo(locInfo));
inverseStrip = inverseAndProgram.strip;
inverse = inverseAndProgram.program;
}
__exports__.prepareBlock = prepareBlock;
});
if (inverted) {
inverted = inverse;
inverse = program;
program = inverted;
}
return new this.BlockStatement(openBlock.path, openBlock.params, openBlock.hash, program, inverse, openBlock.strip, inverseStrip, close && close.strip, this.locInfo(locInfo));
}
});

@@ -1,1077 +0,1055 @@

define(
["../base","../exception","../utils","./code-gen","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) {
"use strict";
var COMPILER_REVISION = __dependency1__.COMPILER_REVISION;
var REVISION_CHANGES = __dependency1__.REVISION_CHANGES;
var Exception = __dependency2__["default"];
var isArray = __dependency3__.isArray;
var CodeGen = __dependency4__["default"];
define(['exports', 'module', '../base', '../exception', '../utils', './code-gen'], function (exports, module, _base, _exception, _utils, _codeGen) {
'use strict';
function Literal(value) {
this.value = value;
}
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj['default'] : obj; };
function JavaScriptCompiler() {}
var _Exception = _interopRequire(_exception);
JavaScriptCompiler.prototype = {
// PUBLIC API: You can override these methods in a subclass to provide
// alternative compiled forms for name lookup and buffering semantics
nameLookup: function(parent, name /* , type*/) {
if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
return [parent, ".", name];
} else {
return [parent, "['", name, "']"];
}
},
depthedLookup: function(name) {
return [this.aliasable('this.lookup'), '(depths, "', name, '")'];
},
var _CodeGen = _interopRequire(_codeGen);
compilerInfo: function() {
var revision = COMPILER_REVISION,
versions = REVISION_CHANGES[revision];
return [revision, versions];
},
function Literal(value) {
this.value = value;
}
appendToBuffer: function(source, location, explicit) {
// Force a source as this simplifies the merge logic.
if (!isArray(source)) {
source = [source];
}
source = this.source.wrap(source, location);
function JavaScriptCompiler() {}
if (this.environment.isSimple) {
return ['return ', source, ';'];
} else if (explicit) {
// This is a case where the buffer operation occurs as a child of another
// construct, generally braces. We have to explicitly output these buffer
// operations to ensure that the emitted code goes in the correct location.
return ['buffer += ', source, ';'];
} else {
source.appendToBuffer = true;
return source;
}
},
JavaScriptCompiler.prototype = {
// PUBLIC API: You can override these methods in a subclass to provide
// alternative compiled forms for name lookup and buffering semantics
nameLookup: function nameLookup(parent, name /* , type*/) {
if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
return [parent, '.', name];
} else {
return [parent, '[\'', name, '\']'];
}
},
depthedLookup: function depthedLookup(name) {
return [this.aliasable('this.lookup'), '(depths, "', name, '")'];
},
initializeBuffer: function() {
return this.quotedString("");
},
// END PUBLIC API
compilerInfo: function compilerInfo() {
var revision = _base.COMPILER_REVISION,
versions = _base.REVISION_CHANGES[revision];
return [revision, versions];
},
compile: function(environment, options, context, asObject) {
this.environment = environment;
this.options = options;
this.stringParams = this.options.stringParams;
this.trackIds = this.options.trackIds;
this.precompile = !asObject;
appendToBuffer: function appendToBuffer(source, location, explicit) {
// Force a source as this simplifies the merge logic.
if (!_utils.isArray(source)) {
source = [source];
}
source = this.source.wrap(source, location);
this.name = this.environment.name;
this.isChild = !!context;
this.context = context || {
programs: [],
environments: []
};
if (this.environment.isSimple) {
return ['return ', source, ';'];
} else if (explicit) {
// This is a case where the buffer operation occurs as a child of another
// construct, generally braces. We have to explicitly output these buffer
// operations to ensure that the emitted code goes in the correct location.
return ['buffer += ', source, ';'];
} else {
source.appendToBuffer = true;
return source;
}
},
this.preamble();
initializeBuffer: function initializeBuffer() {
return this.quotedString('');
},
// END PUBLIC API
this.stackSlot = 0;
this.stackVars = [];
this.aliases = {};
this.registers = { list: [] };
this.hashes = [];
this.compileStack = [];
this.inlineStack = [];
this.blockParams = [];
compile: function compile(environment, options, context, asObject) {
this.environment = environment;
this.options = options;
this.stringParams = this.options.stringParams;
this.trackIds = this.options.trackIds;
this.precompile = !asObject;
this.compileChildren(environment, options);
this.name = this.environment.name;
this.isChild = !!context;
this.context = context || {
programs: [],
environments: []
};
this.useDepths = this.useDepths || environment.useDepths || this.options.compat;
this.useBlockParams = this.useBlockParams || environment.useBlockParams;
this.preamble();
var opcodes = environment.opcodes,
opcode,
firstLoc,
i,
l;
this.stackSlot = 0;
this.stackVars = [];
this.aliases = {};
this.registers = { list: [] };
this.hashes = [];
this.compileStack = [];
this.inlineStack = [];
this.blockParams = [];
for (i = 0, l = opcodes.length; i < l; i++) {
opcode = opcodes[i];
this.compileChildren(environment, options);
this.source.currentLocation = opcode.loc;
firstLoc = firstLoc || opcode.loc;
this[opcode.opcode].apply(this, opcode.args);
}
this.useDepths = this.useDepths || environment.useDepths || this.options.compat;
this.useBlockParams = this.useBlockParams || environment.useBlockParams;
// Flush any trailing content that might be pending.
this.source.currentLocation = firstLoc;
this.pushSource('');
var opcodes = environment.opcodes,
opcode = undefined,
firstLoc = undefined,
i = undefined,
l = undefined;
/* istanbul ignore next */
if (this.stackSlot || this.inlineStack.length || this.compileStack.length) {
throw new Exception('Compile completed with content left on stack');
}
for (i = 0, l = opcodes.length; i < l; i++) {
opcode = opcodes[i];
var fn = this.createFunctionContext(asObject);
if (!this.isChild) {
var ret = {
compiler: this.compilerInfo(),
main: fn
};
var programs = this.context.programs;
for (i = 0, l = programs.length; i < l; i++) {
if (programs[i]) {
ret[i] = programs[i];
}
}
this.source.currentLocation = opcode.loc;
firstLoc = firstLoc || opcode.loc;
this[opcode.opcode].apply(this, opcode.args);
}
if (this.environment.usePartial) {
ret.usePartial = true;
// Flush any trailing content that might be pending.
this.source.currentLocation = firstLoc;
this.pushSource('');
/* istanbul ignore next */
if (this.stackSlot || this.inlineStack.length || this.compileStack.length) {
throw new _Exception('Compile completed with content left on stack');
}
var fn = this.createFunctionContext(asObject);
if (!this.isChild) {
var ret = {
compiler: this.compilerInfo(),
main: fn
};
var programs = this.context.programs;
for (i = 0, l = programs.length; i < l; i++) {
if (programs[i]) {
ret[i] = programs[i];
}
if (this.options.data) {
ret.useData = true;
}
if (this.useDepths) {
ret.useDepths = true;
}
if (this.useBlockParams) {
ret.useBlockParams = true;
}
if (this.options.compat) {
ret.compat = true;
}
}
if (!asObject) {
ret.compiler = JSON.stringify(ret.compiler);
if (this.environment.usePartial) {
ret.usePartial = true;
}
if (this.options.data) {
ret.useData = true;
}
if (this.useDepths) {
ret.useDepths = true;
}
if (this.useBlockParams) {
ret.useBlockParams = true;
}
if (this.options.compat) {
ret.compat = true;
}
this.source.currentLocation = {start: {line: 1, column: 0}};
ret = this.objectLiteral(ret);
if (!asObject) {
ret.compiler = JSON.stringify(ret.compiler);
if (options.srcName) {
ret = ret.toStringWithSourceMap({file: options.destName});
ret.map = ret.map && ret.map.toString();
} else {
ret = ret.toString();
}
this.source.currentLocation = { start: { line: 1, column: 0 } };
ret = this.objectLiteral(ret);
if (options.srcName) {
ret = ret.toStringWithSourceMap({ file: options.destName });
ret.map = ret.map && ret.map.toString();
} else {
ret.compilerOptions = this.options;
ret = ret.toString();
}
return ret;
} else {
return fn;
ret.compilerOptions = this.options;
}
},
preamble: function() {
// track the last context pushed into place to allow skipping the
// getContext opcode when it would be a noop
this.lastContext = 0;
this.source = new CodeGen(this.options.srcName);
},
return ret;
} else {
return fn;
}
},
createFunctionContext: function(asObject) {
var varDeclarations = '';
preamble: function preamble() {
// track the last context pushed into place to allow skipping the
// getContext opcode when it would be a noop
this.lastContext = 0;
this.source = new _CodeGen(this.options.srcName);
},
var locals = this.stackVars.concat(this.registers.list);
if(locals.length > 0) {
varDeclarations += ", " + locals.join(", ");
}
createFunctionContext: function createFunctionContext(asObject) {
var varDeclarations = '';
// Generate minimizer alias mappings
//
// When using true SourceNodes, this will update all references to the given alias
// as the source nodes are reused in situ. For the non-source node compilation mode,
// aliases will not be used, but this case is already being run on the client and
// we aren't concern about minimizing the template size.
var aliasCount = 0;
for (var alias in this.aliases) {
var node = this.aliases[alias];
var locals = this.stackVars.concat(this.registers.list);
if (locals.length > 0) {
varDeclarations += ', ' + locals.join(', ');
}
if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) {
varDeclarations += ', alias' + (++aliasCount) + '=' + alias;
node.children[0] = 'alias' + aliasCount;
}
}
// Generate minimizer alias mappings
//
// When using true SourceNodes, this will update all references to the given alias
// as the source nodes are reused in situ. For the non-source node compilation mode,
// aliases will not be used, but this case is already being run on the client and
// we aren't concern about minimizing the template size.
var aliasCount = 0;
for (var alias in this.aliases) {
// eslint-disable-line guard-for-in
var node = this.aliases[alias];
var params = ["depth0", "helpers", "partials", "data"];
if (this.useBlockParams || this.useDepths) {
params.push('blockParams');
if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) {
varDeclarations += ', alias' + ++aliasCount + '=' + alias;
node.children[0] = 'alias' + aliasCount;
}
if (this.useDepths) {
params.push('depths');
}
}
// Perform a second pass over the output to merge content when possible
var source = this.mergeSource(varDeclarations);
var params = ['depth0', 'helpers', 'partials', 'data'];
if (asObject) {
params.push(source);
if (this.useBlockParams || this.useDepths) {
params.push('blockParams');
}
if (this.useDepths) {
params.push('depths');
}
return Function.apply(this, params);
} else {
return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']);
}
},
mergeSource: function(varDeclarations) {
var isSimple = this.environment.isSimple,
appendOnly = !this.forceBuffer,
appendFirst,
// Perform a second pass over the output to merge content when possible
var source = this.mergeSource(varDeclarations);
sourceSeen,
bufferStart,
bufferEnd;
this.source.each(function(line) {
if (line.appendToBuffer) {
if (bufferStart) {
line.prepend(' + ');
} else {
bufferStart = line;
}
bufferEnd = line;
} else {
if (bufferStart) {
if (!sourceSeen) {
appendFirst = true;
} else {
bufferStart.prepend('buffer += ');
}
bufferEnd.add(';');
bufferStart = bufferEnd = undefined;
}
if (asObject) {
params.push(source);
sourceSeen = true;
if (!isSimple) {
appendOnly = false;
}
}
});
if (appendOnly) {
return Function.apply(this, params);
} else {
return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']);
}
},
mergeSource: function mergeSource(varDeclarations) {
var isSimple = this.environment.isSimple,
appendOnly = !this.forceBuffer,
appendFirst = undefined,
sourceSeen = undefined,
bufferStart = undefined,
bufferEnd = undefined;
this.source.each(function (line) {
if (line.appendToBuffer) {
if (bufferStart) {
bufferStart.prepend('return ');
bufferEnd.add(';');
} else if (!sourceSeen) {
this.source.push('return "";');
line.prepend(' + ');
} else {
bufferStart = line;
}
bufferEnd = line;
} else {
varDeclarations += ", buffer = " + (appendFirst ? '' : this.initializeBuffer());
if (bufferStart) {
bufferStart.prepend('return buffer + ');
if (!sourceSeen) {
appendFirst = true;
} else {
bufferStart.prepend('buffer += ');
}
bufferEnd.add(';');
} else {
this.source.push('return buffer;');
bufferStart = bufferEnd = undefined;
}
sourceSeen = true;
if (!isSimple) {
appendOnly = false;
}
}
});
if (varDeclarations) {
this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n'));
if (appendOnly) {
if (bufferStart) {
bufferStart.prepend('return ');
bufferEnd.add(';');
} else if (!sourceSeen) {
this.source.push('return "";');
}
} else {
varDeclarations += ', buffer = ' + (appendFirst ? '' : this.initializeBuffer());
return this.source.merge();
},
if (bufferStart) {
bufferStart.prepend('return buffer + ');
bufferEnd.add(';');
} else {
this.source.push('return buffer;');
}
}
// [blockValue]
//
// On stack, before: hash, inverse, program, value
// On stack, after: return value of blockHelperMissing
//
// The purpose of this opcode is to take a block of the form
// `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and
// replace it on the stack with the result of properly
// invoking blockHelperMissing.
blockValue: function(name) {
var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'),
params = [this.contextName(0)];
this.setupHelperArgs(name, 0, params);
if (varDeclarations) {
this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n'));
}
var blockName = this.popStack();
params.splice(1, 0, blockName);
return this.source.merge();
},
this.push(this.source.functionCall(blockHelperMissing, 'call', params));
},
// [blockValue]
//
// On stack, before: hash, inverse, program, value
// On stack, after: return value of blockHelperMissing
//
// The purpose of this opcode is to take a block of the form
// `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and
// replace it on the stack with the result of properly
// invoking blockHelperMissing.
blockValue: function blockValue(name) {
var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'),
params = [this.contextName(0)];
this.setupHelperArgs(name, 0, params);
// [ambiguousBlockValue]
//
// On stack, before: hash, inverse, program, value
// Compiler value, before: lastHelper=value of last found helper, if any
// On stack, after, if no lastHelper: same as [blockValue]
// On stack, after, if lastHelper: value
ambiguousBlockValue: function() {
// We're being a bit cheeky and reusing the options value from the prior exec
var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'),
params = [this.contextName(0)];
this.setupHelperArgs('', 0, params, true);
var blockName = this.popStack();
params.splice(1, 0, blockName);
this.flushInline();
this.push(this.source.functionCall(blockHelperMissing, 'call', params));
},
var current = this.topStack();
params.splice(1, 0, current);
// [ambiguousBlockValue]
//
// On stack, before: hash, inverse, program, value
// Compiler value, before: lastHelper=value of last found helper, if any
// On stack, after, if no lastHelper: same as [blockValue]
// On stack, after, if lastHelper: value
ambiguousBlockValue: function ambiguousBlockValue() {
// We're being a bit cheeky and reusing the options value from the prior exec
var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'),
params = [this.contextName(0)];
this.setupHelperArgs('', 0, params, true);
this.pushSource([
'if (!', this.lastHelper, ') { ',
current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params),
'}']);
},
this.flushInline();
// [appendContent]
//
// On stack, before: ...
// On stack, after: ...
//
// Appends the string value of `content` to the current buffer
appendContent: function(content) {
if (this.pendingContent) {
content = this.pendingContent + content;
} else {
this.pendingLocation = this.source.currentLocation;
}
var current = this.topStack();
params.splice(1, 0, current);
this.pendingContent = content;
},
this.pushSource(['if (!', this.lastHelper, ') { ', current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), '}']);
},
// [append]
//
// On stack, before: value, ...
// On stack, after: ...
//
// Coerces `value` to a String and appends it to the current buffer.
//
// If `value` is truthy, or 0, it is coerced into a string and appended
// Otherwise, the empty string is appended
append: function() {
if (this.isInline()) {
this.replaceStack(function(current) {
return [' != null ? ', current, ' : ""'];
});
// [appendContent]
//
// On stack, before: ...
// On stack, after: ...
//
// Appends the string value of `content` to the current buffer
appendContent: function appendContent(content) {
if (this.pendingContent) {
content = this.pendingContent + content;
} else {
this.pendingLocation = this.source.currentLocation;
}
this.pushSource(this.appendToBuffer(this.popStack()));
} else {
var local = this.popStack();
this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']);
if (this.environment.isSimple) {
this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']);
}
}
},
this.pendingContent = content;
},
// [appendEscaped]
//
// On stack, before: value, ...
// On stack, after: ...
//
// Escape `value` and append it to the buffer
appendEscaped: function() {
this.pushSource(this.appendToBuffer(
[this.aliasable('this.escapeExpression'), '(', this.popStack(), ')']));
},
// [append]
//
// On stack, before: value, ...
// On stack, after: ...
//
// Coerces `value` to a String and appends it to the current buffer.
//
// If `value` is truthy, or 0, it is coerced into a string and appended
// Otherwise, the empty string is appended
append: function append() {
if (this.isInline()) {
this.replaceStack(function (current) {
return [' != null ? ', current, ' : ""'];
});
// [getContext]
//
// On stack, before: ...
// On stack, after: ...
// Compiler value, after: lastContext=depth
//
// Set the value of the `lastContext` compiler value to the depth
getContext: function(depth) {
this.lastContext = depth;
},
this.pushSource(this.appendToBuffer(this.popStack()));
} else {
var local = this.popStack();
this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']);
if (this.environment.isSimple) {
this.pushSource(['else { ', this.appendToBuffer('\'\'', undefined, true), ' }']);
}
}
},
// [pushContext]
//
// On stack, before: ...
// On stack, after: currentContext, ...
//
// Pushes the value of the current context onto the stack.
pushContext: function() {
this.pushStackLiteral(this.contextName(this.lastContext));
},
// [appendEscaped]
//
// On stack, before: value, ...
// On stack, after: ...
//
// Escape `value` and append it to the buffer
appendEscaped: function appendEscaped() {
this.pushSource(this.appendToBuffer([this.aliasable('this.escapeExpression'), '(', this.popStack(), ')']));
},
// [lookupOnContext]
//
// On stack, before: ...
// On stack, after: currentContext[name], ...
//
// Looks up the value of `name` on the current context and pushes
// it onto the stack.
lookupOnContext: function(parts, falsy, scoped) {
var i = 0;
// [getContext]
//
// On stack, before: ...
// On stack, after: ...
// Compiler value, after: lastContext=depth
//
// Set the value of the `lastContext` compiler value to the depth
getContext: function getContext(depth) {
this.lastContext = depth;
},
if (!scoped && this.options.compat && !this.lastContext) {
// The depthed query is expected to handle the undefined logic for the root level that
// is implemented below, so we evaluate that directly in compat mode
this.push(this.depthedLookup(parts[i++]));
} else {
this.pushContext();
}
// [pushContext]
//
// On stack, before: ...
// On stack, after: currentContext, ...
//
// Pushes the value of the current context onto the stack.
pushContext: function pushContext() {
this.pushStackLiteral(this.contextName(this.lastContext));
},
this.resolvePath('context', parts, i, falsy);
},
// [lookupOnContext]
//
// On stack, before: ...
// On stack, after: currentContext[name], ...
//
// Looks up the value of `name` on the current context and pushes
// it onto the stack.
lookupOnContext: function lookupOnContext(parts, falsy, scoped) {
var i = 0;
// [lookupBlockParam]
//
// On stack, before: ...
// On stack, after: blockParam[name], ...
//
// Looks up the value of `parts` on the given block param and pushes
// it onto the stack.
lookupBlockParam: function(blockParamId, parts) {
this.useBlockParams = true;
if (!scoped && this.options.compat && !this.lastContext) {
// The depthed query is expected to handle the undefined logic for the root level that
// is implemented below, so we evaluate that directly in compat mode
this.push(this.depthedLookup(parts[i++]));
} else {
this.pushContext();
}
this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']);
this.resolvePath('context', parts, 1);
},
this.resolvePath('context', parts, i, falsy);
},
// [lookupData]
//
// On stack, before: ...
// On stack, after: data, ...
//
// Push the data lookup operator
lookupData: function(depth, parts) {
/*jshint -W083 */
if (!depth) {
this.pushStackLiteral('data');
} else {
this.pushStackLiteral('this.data(data, ' + depth + ')');
}
// [lookupBlockParam]
//
// On stack, before: ...
// On stack, after: blockParam[name], ...
//
// Looks up the value of `parts` on the given block param and pushes
// it onto the stack.
lookupBlockParam: function lookupBlockParam(blockParamId, parts) {
this.useBlockParams = true;
this.resolvePath('data', parts, 0, true);
},
this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']);
this.resolvePath('context', parts, 1);
},
resolvePath: function(type, parts, i, falsy) {
/*jshint -W083 */
if (this.options.strict || this.options.assumeObjects) {
this.push(strictLookup(this.options.strict, this, parts, type));
return;
}
// [lookupData]
//
// On stack, before: ...
// On stack, after: data, ...
//
// Push the data lookup operator
lookupData: function lookupData(depth, parts) {
/*jshint -W083 */
if (!depth) {
this.pushStackLiteral('data');
} else {
this.pushStackLiteral('this.data(data, ' + depth + ')');
}
var len = parts.length;
for (; i < len; i++) {
this.replaceStack(function(current) {
var lookup = this.nameLookup(current, parts[i], type);
// We want to ensure that zero and false are handled properly if the context (falsy flag)
// needs to have the special handling for these values.
if (!falsy) {
return [' != null ? ', lookup, ' : ', current];
} else {
// Otherwise we can use generic falsy handling
return [' && ', lookup];
}
});
}
},
this.resolvePath('data', parts, 0, true);
},
// [resolvePossibleLambda]
//
// On stack, before: value, ...
// On stack, after: resolved value, ...
//
// If the `value` is a lambda, replace it on the stack by
// the return value of the lambda
resolvePossibleLambda: function() {
this.push([this.aliasable('this.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']);
},
resolvePath: function resolvePath(type, parts, i, falsy) {
var _this = this;
// [pushStringParam]
//
// On stack, before: ...
// On stack, after: string, currentContext, ...
//
// This opcode is designed for use in string mode, which
// provides the string value of a parameter along with its
// depth rather than resolving it immediately.
pushStringParam: function(string, type) {
this.pushContext();
this.pushString(type);
/*jshint -W083 */
if (this.options.strict || this.options.assumeObjects) {
this.push(strictLookup(this.options.strict, this, parts, type));
return;
}
// If it's a subexpression, the string result
// will be pushed after this opcode.
if (type !== 'SubExpression') {
if (typeof string === 'string') {
this.pushString(string);
var len = parts.length;
for (; i < len; i++) {
/*eslint-disable no-loop-func */
this.replaceStack(function (current) {
var lookup = _this.nameLookup(current, parts[i], type);
// We want to ensure that zero and false are handled properly if the context (falsy flag)
// needs to have the special handling for these values.
if (!falsy) {
return [' != null ? ', lookup, ' : ', current];
} else {
this.pushStackLiteral(string);
// Otherwise we can use generic falsy handling
return [' && ', lookup];
}
}
},
});
/*eslint-enable no-loop-func */
}
},
emptyHash: function(omitEmpty) {
if (this.trackIds) {
this.push('{}'); // hashIds
}
if (this.stringParams) {
this.push('{}'); // hashContexts
this.push('{}'); // hashTypes
}
this.pushStackLiteral(omitEmpty ? 'undefined' : '{}');
},
pushHash: function() {
if (this.hash) {
this.hashes.push(this.hash);
}
this.hash = {values: [], types: [], contexts: [], ids: []};
},
popHash: function() {
var hash = this.hash;
this.hash = this.hashes.pop();
// [resolvePossibleLambda]
//
// On stack, before: value, ...
// On stack, after: resolved value, ...
//
// If the `value` is a lambda, replace it on the stack by
// the return value of the lambda
resolvePossibleLambda: function resolvePossibleLambda() {
this.push([this.aliasable('this.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']);
},
if (this.trackIds) {
this.push(this.objectLiteral(hash.ids));
// [pushStringParam]
//
// On stack, before: ...
// On stack, after: string, currentContext, ...
//
// This opcode is designed for use in string mode, which
// provides the string value of a parameter along with its
// depth rather than resolving it immediately.
pushStringParam: function pushStringParam(string, type) {
this.pushContext();
this.pushString(type);
// If it's a subexpression, the string result
// will be pushed after this opcode.
if (type !== 'SubExpression') {
if (typeof string === 'string') {
this.pushString(string);
} else {
this.pushStackLiteral(string);
}
if (this.stringParams) {
this.push(this.objectLiteral(hash.contexts));
this.push(this.objectLiteral(hash.types));
}
}
},
this.push(this.objectLiteral(hash.values));
},
emptyHash: function emptyHash(omitEmpty) {
if (this.trackIds) {
this.push('{}'); // hashIds
}
if (this.stringParams) {
this.push('{}'); // hashContexts
this.push('{}'); // hashTypes
}
this.pushStackLiteral(omitEmpty ? 'undefined' : '{}');
},
pushHash: function pushHash() {
if (this.hash) {
this.hashes.push(this.hash);
}
this.hash = { values: [], types: [], contexts: [], ids: [] };
},
popHash: function popHash() {
var hash = this.hash;
this.hash = this.hashes.pop();
// [pushString]
//
// On stack, before: ...
// On stack, after: quotedString(string), ...
//
// Push a quoted version of `string` onto the stack
pushString: function(string) {
this.pushStackLiteral(this.quotedString(string));
},
if (this.trackIds) {
this.push(this.objectLiteral(hash.ids));
}
if (this.stringParams) {
this.push(this.objectLiteral(hash.contexts));
this.push(this.objectLiteral(hash.types));
}
// [pushLiteral]
//
// On stack, before: ...
// On stack, after: value, ...
//
// Pushes a value onto the stack. This operation prevents
// the compiler from creating a temporary variable to hold
// it.
pushLiteral: function(value) {
this.pushStackLiteral(value);
},
this.push(this.objectLiteral(hash.values));
},
// [pushProgram]
//
// On stack, before: ...
// On stack, after: program(guid), ...
//
// Push a program expression onto the stack. This takes
// a compile-time guid and converts it into a runtime-accessible
// expression.
pushProgram: function(guid) {
if (guid != null) {
this.pushStackLiteral(this.programExpression(guid));
} else {
this.pushStackLiteral(null);
}
},
// [pushString]
//
// On stack, before: ...
// On stack, after: quotedString(string), ...
//
// Push a quoted version of `string` onto the stack
pushString: function pushString(string) {
this.pushStackLiteral(this.quotedString(string));
},
// [invokeHelper]
//
// On stack, before: hash, inverse, program, params..., ...
// On stack, after: result of helper invocation
//
// Pops off the helper's parameters, invokes the helper,
// and pushes the helper's return value onto the stack.
//
// If the helper is not found, `helperMissing` is called.
invokeHelper: function(paramSize, name, isSimple) {
var nonHelper = this.popStack();
var helper = this.setupHelper(paramSize, name);
var simple = isSimple ? [helper.name, ' || '] : '';
// [pushLiteral]
//
// On stack, before: ...
// On stack, after: value, ...
//
// Pushes a value onto the stack. This operation prevents
// the compiler from creating a temporary variable to hold
// it.
pushLiteral: function pushLiteral(value) {
this.pushStackLiteral(value);
},
var lookup = ['('].concat(simple, nonHelper);
if (!this.options.strict) {
lookup.push(' || ', this.aliasable('helpers.helperMissing'));
}
lookup.push(')');
// [pushProgram]
//
// On stack, before: ...
// On stack, after: program(guid), ...
//
// Push a program expression onto the stack. This takes
// a compile-time guid and converts it into a runtime-accessible
// expression.
pushProgram: function pushProgram(guid) {
if (guid != null) {
this.pushStackLiteral(this.programExpression(guid));
} else {
this.pushStackLiteral(null);
}
},
this.push(this.source.functionCall(lookup, 'call', helper.callParams));
},
// [invokeHelper]
//
// On stack, before: hash, inverse, program, params..., ...
// On stack, after: result of helper invocation
//
// Pops off the helper's parameters, invokes the helper,
// and pushes the helper's return value onto the stack.
//
// If the helper is not found, `helperMissing` is called.
invokeHelper: function invokeHelper(paramSize, name, isSimple) {
var nonHelper = this.popStack(),
helper = this.setupHelper(paramSize, name),
simple = isSimple ? [helper.name, ' || '] : '';
// [invokeKnownHelper]
//
// On stack, before: hash, inverse, program, params..., ...
// On stack, after: result of helper invocation
//
// This operation is used when the helper is known to exist,
// so a `helperMissing` fallback is not required.
invokeKnownHelper: function(paramSize, name) {
var helper = this.setupHelper(paramSize, name);
this.push(this.source.functionCall(helper.name, 'call', helper.callParams));
},
var lookup = ['('].concat(simple, nonHelper);
if (!this.options.strict) {
lookup.push(' || ', this.aliasable('helpers.helperMissing'));
}
lookup.push(')');
// [invokeAmbiguous]
//
// On stack, before: hash, inverse, program, params..., ...
// On stack, after: result of disambiguation
//
// This operation is used when an expression like `{{foo}}`
// is provided, but we don't know at compile-time whether it
// is a helper or a path.
//
// This operation emits more code than the other options,
// and can be avoided by passing the `knownHelpers` and
// `knownHelpersOnly` flags at compile-time.
invokeAmbiguous: function(name, helperCall) {
this.useRegister('helper');
this.push(this.source.functionCall(lookup, 'call', helper.callParams));
},
var nonHelper = this.popStack();
// [invokeKnownHelper]
//
// On stack, before: hash, inverse, program, params..., ...
// On stack, after: result of helper invocation
//
// This operation is used when the helper is known to exist,
// so a `helperMissing` fallback is not required.
invokeKnownHelper: function invokeKnownHelper(paramSize, name) {
var helper = this.setupHelper(paramSize, name);
this.push(this.source.functionCall(helper.name, 'call', helper.callParams));
},
this.emptyHash();
var helper = this.setupHelper(0, name, helperCall);
// [invokeAmbiguous]
//
// On stack, before: hash, inverse, program, params..., ...
// On stack, after: result of disambiguation
//
// This operation is used when an expression like `{{foo}}`
// is provided, but we don't know at compile-time whether it
// is a helper or a path.
//
// This operation emits more code than the other options,
// and can be avoided by passing the `knownHelpers` and
// `knownHelpersOnly` flags at compile-time.
invokeAmbiguous: function invokeAmbiguous(name, helperCall) {
this.useRegister('helper');
var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper');
var nonHelper = this.popStack();
var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')'];
if (!this.options.strict) {
lookup[0] = '(helper = ';
lookup.push(
' != null ? helper : ',
this.aliasable('helpers.helperMissing')
);
}
this.emptyHash();
var helper = this.setupHelper(0, name, helperCall);
this.push([
'(', lookup,
(helper.paramsInit ? ['),(', helper.paramsInit] : []), '),',
'(typeof helper === ', this.aliasable('"function"'), ' ? ',
this.source.functionCall('helper','call', helper.callParams), ' : helper))'
]);
},
var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper');
// [invokePartial]
//
// On stack, before: context, ...
// On stack after: result of partial invocation
//
// This operation pops off a context, invokes a partial with that context,
// and pushes the result of the invocation back.
invokePartial: function(isDynamic, name, indent) {
var params = [],
options = this.setupParams(name, 1, params, false);
var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')'];
if (!this.options.strict) {
lookup[0] = '(helper = ';
lookup.push(' != null ? helper : ', this.aliasable('helpers.helperMissing'));
}
if (isDynamic) {
name = this.popStack();
delete options.name;
}
this.push(['(', lookup, helper.paramsInit ? ['),(', helper.paramsInit] : [], '),', '(typeof helper === ', this.aliasable('"function"'), ' ? ', this.source.functionCall('helper', 'call', helper.callParams), ' : helper))']);
},
if (indent) {
options.indent = JSON.stringify(indent);
}
options.helpers = 'helpers';
options.partials = 'partials';
// [invokePartial]
//
// On stack, before: context, ...
// On stack after: result of partial invocation
//
// This operation pops off a context, invokes a partial with that context,
// and pushes the result of the invocation back.
invokePartial: function invokePartial(isDynamic, name, indent) {
var params = [],
options = this.setupParams(name, 1, params, false);
if (!isDynamic) {
params.unshift(this.nameLookup('partials', name, 'partial'));
} else {
params.unshift(name);
}
if (isDynamic) {
name = this.popStack();
delete options.name;
}
if (this.options.compat) {
options.depths = 'depths';
}
options = this.objectLiteral(options);
params.push(options);
if (indent) {
options.indent = JSON.stringify(indent);
}
options.helpers = 'helpers';
options.partials = 'partials';
this.push(this.source.functionCall('this.invokePartial', '', params));
},
if (!isDynamic) {
params.unshift(this.nameLookup('partials', name, 'partial'));
} else {
params.unshift(name);
}
// [assignToHash]
//
// On stack, before: value, ..., hash, ...
// On stack, after: ..., hash, ...
//
// Pops a value off the stack and assigns it to the current hash
assignToHash: function(key) {
var value = this.popStack(),
context,
type,
id;
if (this.options.compat) {
options.depths = 'depths';
}
options = this.objectLiteral(options);
params.push(options);
if (this.trackIds) {
id = this.popStack();
}
if (this.stringParams) {
type = this.popStack();
context = this.popStack();
}
this.push(this.source.functionCall('this.invokePartial', '', params));
},
var hash = this.hash;
if (context) {
hash.contexts[key] = context;
}
if (type) {
hash.types[key] = type;
}
if (id) {
hash.ids[key] = id;
}
hash.values[key] = value;
},
// [assignToHash]
//
// On stack, before: value, ..., hash, ...
// On stack, after: ..., hash, ...
//
// Pops a value off the stack and assigns it to the current hash
assignToHash: function assignToHash(key) {
var value = this.popStack(),
context = undefined,
type = undefined,
id = undefined;
pushId: function(type, name, child) {
if (type === 'BlockParam') {
this.pushStackLiteral(
'blockParams[' + name[0] + '].path[' + name[1] + ']'
+ (child ? ' + ' + JSON.stringify('.' + child) : ''));
} else if (type === 'PathExpression') {
this.pushString(name);
} else if (type === 'SubExpression') {
this.pushStackLiteral('true');
} else {
this.pushStackLiteral('null');
}
},
if (this.trackIds) {
id = this.popStack();
}
if (this.stringParams) {
type = this.popStack();
context = this.popStack();
}
// HELPERS
var hash = this.hash;
if (context) {
hash.contexts[key] = context;
}
if (type) {
hash.types[key] = type;
}
if (id) {
hash.ids[key] = id;
}
hash.values[key] = value;
},
compiler: JavaScriptCompiler,
pushId: function pushId(type, name, child) {
if (type === 'BlockParam') {
this.pushStackLiteral('blockParams[' + name[0] + '].path[' + name[1] + ']' + (child ? ' + ' + JSON.stringify('.' + child) : ''));
} else if (type === 'PathExpression') {
this.pushString(name);
} else if (type === 'SubExpression') {
this.pushStackLiteral('true');
} else {
this.pushStackLiteral('null');
}
},
compileChildren: function(environment, options) {
var children = environment.children, child, compiler;
// HELPERS
for(var i=0, l=children.length; i<l; i++) {
child = children[i];
compiler = new this.compiler();
compiler: JavaScriptCompiler,
var index = this.matchExistingProgram(child);
compileChildren: function compileChildren(environment, options) {
var children = environment.children,
child = undefined,
compiler = undefined;
if (index == null) {
this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children
index = this.context.programs.length;
child.index = index;
child.name = 'program' + index;
this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile);
this.context.environments[index] = child;
for (var i = 0, l = children.length; i < l; i++) {
child = children[i];
compiler = new this.compiler(); // eslint-disable-line new-cap
this.useDepths = this.useDepths || compiler.useDepths;
this.useBlockParams = this.useBlockParams || compiler.useBlockParams;
} else {
child.index = index;
child.name = 'program' + index;
var index = this.matchExistingProgram(child);
this.useDepths = this.useDepths || child.useDepths;
this.useBlockParams = this.useBlockParams || child.useBlockParams;
}
}
},
matchExistingProgram: function(child) {
for (var i = 0, len = this.context.environments.length; i < len; i++) {
var environment = this.context.environments[i];
if (environment && environment.equals(child)) {
return i;
}
}
},
if (index == null) {
this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children
index = this.context.programs.length;
child.index = index;
child.name = 'program' + index;
this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile);
this.context.environments[index] = child;
programExpression: function(guid) {
var child = this.environment.children[guid],
programParams = [child.index, 'data', child.blockParams];
this.useDepths = this.useDepths || compiler.useDepths;
this.useBlockParams = this.useBlockParams || compiler.useBlockParams;
} else {
child.index = index;
child.name = 'program' + index;
if (this.useBlockParams || this.useDepths) {
programParams.push('blockParams');
this.useDepths = this.useDepths || child.useDepths;
this.useBlockParams = this.useBlockParams || child.useBlockParams;
}
if (this.useDepths) {
programParams.push('depths');
}
},
matchExistingProgram: function matchExistingProgram(child) {
for (var i = 0, len = this.context.environments.length; i < len; i++) {
var environment = this.context.environments[i];
if (environment && environment.equals(child)) {
return i;
}
}
},
return 'this.program(' + programParams.join(', ') + ')';
},
programExpression: function programExpression(guid) {
var child = this.environment.children[guid],
programParams = [child.index, 'data', child.blockParams];
useRegister: function(name) {
if(!this.registers[name]) {
this.registers[name] = true;
this.registers.list.push(name);
}
},
if (this.useBlockParams || this.useDepths) {
programParams.push('blockParams');
}
if (this.useDepths) {
programParams.push('depths');
}
push: function(expr) {
if (!(expr instanceof Literal)) {
expr = this.source.wrap(expr);
}
return 'this.program(' + programParams.join(', ') + ')';
},
this.inlineStack.push(expr);
return expr;
},
useRegister: function useRegister(name) {
if (!this.registers[name]) {
this.registers[name] = true;
this.registers.list.push(name);
}
},
pushStackLiteral: function(item) {
this.push(new Literal(item));
},
push: function push(expr) {
if (!(expr instanceof Literal)) {
expr = this.source.wrap(expr);
}
pushSource: function(source) {
if (this.pendingContent) {
this.source.push(
this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation));
this.pendingContent = undefined;
}
this.inlineStack.push(expr);
return expr;
},
if (source) {
this.source.push(source);
}
},
pushStackLiteral: function pushStackLiteral(item) {
this.push(new Literal(item));
},
replaceStack: function(callback) {
var prefix = ['('],
stack,
createdStack,
usedLiteral;
pushSource: function pushSource(source) {
if (this.pendingContent) {
this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation));
this.pendingContent = undefined;
}
/* istanbul ignore next */
if (!this.isInline()) {
throw new Exception('replaceStack on non-inline');
}
if (source) {
this.source.push(source);
}
},
// We want to merge the inline statement into the replacement statement via ','
var top = this.popStack(true);
replaceStack: function replaceStack(callback) {
var prefix = ['('],
stack = undefined,
createdStack = undefined,
usedLiteral = undefined;
if (top instanceof Literal) {
// Literals do not need to be inlined
stack = [top.value];
prefix = ['(', stack];
usedLiteral = true;
} else {
// Get or create the current stack name for use by the inline
createdStack = true;
var name = this.incrStack();
/* istanbul ignore next */
if (!this.isInline()) {
throw new _Exception('replaceStack on non-inline');
}
prefix = ['((', this.push(name), ' = ', top, ')'];
stack = this.topStack();
}
// We want to merge the inline statement into the replacement statement via ','
var top = this.popStack(true);
var item = callback.call(this, stack);
if (top instanceof Literal) {
// Literals do not need to be inlined
stack = [top.value];
prefix = ['(', stack];
usedLiteral = true;
} else {
// Get or create the current stack name for use by the inline
createdStack = true;
var _name = this.incrStack();
if (!usedLiteral) {
this.popStack();
}
if (createdStack) {
this.stackSlot--;
}
this.push(prefix.concat(item, ')'));
},
prefix = ['((', this.push(_name), ' = ', top, ')'];
stack = this.topStack();
}
incrStack: function() {
this.stackSlot++;
if(this.stackSlot > this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); }
return this.topStackName();
},
topStackName: function() {
return "stack" + this.stackSlot;
},
flushInline: function() {
var inlineStack = this.inlineStack;
this.inlineStack = [];
for (var i = 0, len = inlineStack.length; i < len; i++) {
var entry = inlineStack[i];
/* istanbul ignore if */
if (entry instanceof Literal) {
this.compileStack.push(entry);
} else {
var stack = this.incrStack();
this.pushSource([stack, ' = ', entry, ';']);
this.compileStack.push(stack);
}
}
},
isInline: function() {
return this.inlineStack.length;
},
var item = callback.call(this, stack);
popStack: function(wrapped) {
var inline = this.isInline(),
item = (inline ? this.inlineStack : this.compileStack).pop();
if (!usedLiteral) {
this.popStack();
}
if (createdStack) {
this.stackSlot--;
}
this.push(prefix.concat(item, ')'));
},
if (!wrapped && (item instanceof Literal)) {
return item.value;
incrStack: function incrStack() {
this.stackSlot++;
if (this.stackSlot > this.stackVars.length) {
this.stackVars.push('stack' + this.stackSlot);
}
return this.topStackName();
},
topStackName: function topStackName() {
return 'stack' + this.stackSlot;
},
flushInline: function flushInline() {
var inlineStack = this.inlineStack;
this.inlineStack = [];
for (var i = 0, len = inlineStack.length; i < len; i++) {
var entry = inlineStack[i];
/* istanbul ignore if */
if (entry instanceof Literal) {
this.compileStack.push(entry);
} else {
if (!inline) {
/* istanbul ignore next */
if (!this.stackSlot) {
throw new Exception('Invalid stack pop');
}
this.stackSlot--;
}
return item;
var stack = this.incrStack();
this.pushSource([stack, ' = ', entry, ';']);
this.compileStack.push(stack);
}
},
}
},
isInline: function isInline() {
return this.inlineStack.length;
},
topStack: function() {
var stack = (this.isInline() ? this.inlineStack : this.compileStack),
item = stack[stack.length - 1];
popStack: function popStack(wrapped) {
var inline = this.isInline(),
item = (inline ? this.inlineStack : this.compileStack).pop();
/* istanbul ignore if */
if (item instanceof Literal) {
return item.value;
} else {
return item;
if (!wrapped && item instanceof Literal) {
return item.value;
} else {
if (!inline) {
/* istanbul ignore next */
if (!this.stackSlot) {
throw new _Exception('Invalid stack pop');
}
this.stackSlot--;
}
},
return item;
}
},
contextName: function(context) {
if (this.useDepths && context) {
return 'depths[' + context + ']';
} else {
return 'depth' + context;
}
},
topStack: function topStack() {
var stack = this.isInline() ? this.inlineStack : this.compileStack,
item = stack[stack.length - 1];
quotedString: function(str) {
return this.source.quotedString(str);
},
/* istanbul ignore if */
if (item instanceof Literal) {
return item.value;
} else {
return item;
}
},
objectLiteral: function(obj) {
return this.source.objectLiteral(obj);
},
contextName: function contextName(context) {
if (this.useDepths && context) {
return 'depths[' + context + ']';
} else {
return 'depth' + context;
}
},
aliasable: function(name) {
var ret = this.aliases[name];
if (ret) {
ret.referenceCount++;
return ret;
}
quotedString: function quotedString(str) {
return this.source.quotedString(str);
},
ret = this.aliases[name] = this.source.wrap(name);
ret.aliasable = true;
ret.referenceCount = 1;
objectLiteral: function objectLiteral(obj) {
return this.source.objectLiteral(obj);
},
aliasable: function aliasable(name) {
var ret = this.aliases[name];
if (ret) {
ret.referenceCount++;
return ret;
},
}
setupHelper: function(paramSize, name, blockHelper) {
var params = [],
paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper);
var foundHelper = this.nameLookup('helpers', name, 'helper');
ret = this.aliases[name] = this.source.wrap(name);
ret.aliasable = true;
ret.referenceCount = 1;
return {
params: params,
paramsInit: paramsInit,
name: foundHelper,
callParams: [this.contextName(0)].concat(params)
};
},
return ret;
},
setupParams: function(helper, paramSize, params) {
var options = {}, contexts = [], types = [], ids = [], param;
setupHelper: function setupHelper(paramSize, name, blockHelper) {
var params = [],
paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper);
var foundHelper = this.nameLookup('helpers', name, 'helper');
options.name = this.quotedString(helper);
options.hash = this.popStack();
return {
params: params,
paramsInit: paramsInit,
name: foundHelper,
callParams: [this.contextName(0)].concat(params)
};
},
if (this.trackIds) {
options.hashIds = this.popStack();
}
if (this.stringParams) {
options.hashTypes = this.popStack();
options.hashContexts = this.popStack();
}
setupParams: function setupParams(helper, paramSize, params) {
var options = {},
contexts = [],
types = [],
ids = [],
param = undefined;
var inverse = this.popStack(),
program = this.popStack();
options.name = this.quotedString(helper);
options.hash = 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) {
options.fn = program || 'this.noop';
options.inverse = inverse || 'this.noop';
}
if (this.trackIds) {
options.hashIds = this.popStack();
}
if (this.stringParams) {
options.hashTypes = this.popStack();
options.hashContexts = this.popStack();
}
// The parameters go on to the stack in order (making sure that they are evaluated in order)
// so we need to pop them off the stack in reverse order
var i = paramSize;
while (i--) {
param = this.popStack();
params[i] = param;
var inverse = this.popStack(),
program = this.popStack();
if (this.trackIds) {
ids[i] = this.popStack();
}
if (this.stringParams) {
types[i] = this.popStack();
contexts[i] = 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) {
options.fn = program || 'this.noop';
options.inverse = inverse || 'this.noop';
}
// The parameters go on to the stack in order (making sure that they are evaluated in order)
// so we need to pop them off the stack in reverse order
var i = paramSize;
while (i--) {
param = this.popStack();
params[i] = param;
if (this.trackIds) {
options.ids = this.source.generateArray(ids);
ids[i] = this.popStack();
}
if (this.stringParams) {
options.types = this.source.generateArray(types);
options.contexts = this.source.generateArray(contexts);
types[i] = this.popStack();
contexts[i] = this.popStack();
}
}
if (this.options.data) {
options.data = 'data';
}
if (this.useBlockParams) {
options.blockParams = 'blockParams';
}
return options;
},
if (this.trackIds) {
options.ids = this.source.generateArray(ids);
}
if (this.stringParams) {
options.types = this.source.generateArray(types);
options.contexts = this.source.generateArray(contexts);
}
setupHelperArgs: function(helper, paramSize, params, useRegister) {
var options = this.setupParams(helper, paramSize, params, true);
options = this.objectLiteral(options);
if (useRegister) {
this.useRegister('options');
params.push('options');
return ['options=', options];
} else {
params.push(options);
return '';
}
if (this.options.data) {
options.data = 'data';
}
};
if (this.useBlockParams) {
options.blockParams = 'blockParams';
}
return options;
},
setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister) {
var options = this.setupParams(helper, paramSize, params, true);
options = this.objectLiteral(options);
if (useRegister) {
this.useRegister('options');
params.push('options');
return ['options=', options];
} else {
params.push(options);
return '';
}
}
};
var reservedWords = (
"break else new var" +
" case finally return void" +
" catch for switch while" +
" continue function this with" +
" default if throw" +
" delete in try" +
" do instanceof typeof" +
" abstract enum int short" +
" boolean export interface static" +
" byte extends long super" +
" char final native synchronized" +
" class float package throws" +
" const goto private transient" +
" debugger implements protected volatile" +
" double import public let yield await" +
" null true false"
).split(" ");
(function () {
var reservedWords = ('break else new var' + ' case finally return void' + ' catch for switch while' + ' continue function this with' + ' default if throw' + ' delete in try' + ' do instanceof typeof' + ' abstract enum int short' + ' boolean export interface static' + ' byte extends long super' + ' char final native synchronized' + ' class float package throws' + ' const goto private transient' + ' debugger implements protected volatile' + ' double import public let yield await' + ' null true false').split(' ');
var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};
for(var i=0, l=reservedWords.length; i<l; i++) {
for (var i = 0, l = reservedWords.length; i < l; i++) {
compilerWords[reservedWords[i]] = true;
}
})();
JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name);
};
JavaScriptCompiler.isValidJavaScriptVariableName = function (name) {
return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name);
};
function strictLookup(requireTerminal, compiler, parts, type) {
var stack = compiler.popStack();
function strictLookup(requireTerminal, compiler, parts, type) {
var stack = compiler.popStack(),
i = 0,
len = parts.length;
if (requireTerminal) {
len--;
}
var i = 0,
len = parts.length;
if (requireTerminal) {
len--;
}
for (; i < len; i++) {
stack = compiler.nameLookup(stack, parts[i], type);
}
for (; i < len; i++) {
stack = compiler.nameLookup(stack, parts[i], type);
}
if (requireTerminal) {
return [compiler.aliasable('this.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ')'];
} else {
return stack;
}
if (requireTerminal) {
return [compiler.aliasable('this.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ')'];
} else {
return stack;
}
}
__exports__["default"] = JavaScriptCompiler;
});
module.exports = JavaScriptCompiler;
});

@@ -1,562 +0,681 @@

define(
["exports"],
function(__exports__) {
"use strict";
define(["exports", "module"], function (exports, module) {
/* jshint ignore:start */
/* istanbul ignore next */
/* Jison generated parser */
var handlebars = (function(){
var parser = {trace: function trace() { },
yy: {},
symbols_: {"error":2,"root":3,"program":4,"EOF":5,"program_repetition0":6,"statement":7,"mustache":8,"block":9,"rawBlock":10,"partial":11,"content":12,"COMMENT":13,"CONTENT":14,"openRawBlock":15,"END_RAW_BLOCK":16,"OPEN_RAW_BLOCK":17,"helperName":18,"openRawBlock_repetition0":19,"openRawBlock_option0":20,"CLOSE_RAW_BLOCK":21,"openBlock":22,"block_option0":23,"closeBlock":24,"openInverse":25,"block_option1":26,"OPEN_BLOCK":27,"openBlock_repetition0":28,"openBlock_option0":29,"openBlock_option1":30,"CLOSE":31,"OPEN_INVERSE":32,"openInverse_repetition0":33,"openInverse_option0":34,"openInverse_option1":35,"openInverseChain":36,"OPEN_INVERSE_CHAIN":37,"openInverseChain_repetition0":38,"openInverseChain_option0":39,"openInverseChain_option1":40,"inverseAndProgram":41,"INVERSE":42,"inverseChain":43,"inverseChain_option0":44,"OPEN_ENDBLOCK":45,"OPEN":46,"mustache_repetition0":47,"mustache_option0":48,"OPEN_UNESCAPED":49,"mustache_repetition1":50,"mustache_option1":51,"CLOSE_UNESCAPED":52,"OPEN_PARTIAL":53,"partialName":54,"partial_repetition0":55,"partial_option0":56,"param":57,"sexpr":58,"OPEN_SEXPR":59,"sexpr_repetition0":60,"sexpr_option0":61,"CLOSE_SEXPR":62,"hash":63,"hash_repetition_plus0":64,"hashSegment":65,"ID":66,"EQUALS":67,"blockParams":68,"OPEN_BLOCK_PARAMS":69,"blockParams_repetition_plus0":70,"CLOSE_BLOCK_PARAMS":71,"path":72,"dataName":73,"STRING":74,"NUMBER":75,"BOOLEAN":76,"DATA":77,"pathSegments":78,"SEP":79,"$accept":0,"$end":1},
terminals_: {2:"error",5:"EOF",13:"COMMENT",14:"CONTENT",16:"END_RAW_BLOCK",17:"OPEN_RAW_BLOCK",21:"CLOSE_RAW_BLOCK",27:"OPEN_BLOCK",31:"CLOSE",32:"OPEN_INVERSE",37:"OPEN_INVERSE_CHAIN",42:"INVERSE",45:"OPEN_ENDBLOCK",46:"OPEN",49:"OPEN_UNESCAPED",52:"CLOSE_UNESCAPED",53:"OPEN_PARTIAL",59:"OPEN_SEXPR",62:"CLOSE_SEXPR",66:"ID",67:"EQUALS",69:"OPEN_BLOCK_PARAMS",71:"CLOSE_BLOCK_PARAMS",74:"STRING",75:"NUMBER",76:"BOOLEAN",77:"DATA",79:"SEP"},
productions_: [0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[12,1],[10,3],[15,5],[9,4],[9,4],[22,6],[25,6],[36,6],[41,2],[43,3],[43,1],[24,3],[8,5],[8,5],[11,5],[57,1],[57,1],[58,5],[63,1],[65,3],[68,3],[18,1],[18,1],[18,1],[18,1],[18,1],[54,1],[54,1],[73,2],[72,1],[78,3],[78,1],[6,0],[6,2],[19,0],[19,2],[20,0],[20,1],[23,0],[23,1],[26,0],[26,1],[28,0],[28,2],[29,0],[29,1],[30,0],[30,1],[33,0],[33,2],[34,0],[34,1],[35,0],[35,1],[38,0],[38,2],[39,0],[39,1],[40,0],[40,1],[44,0],[44,1],[47,0],[47,2],[48,0],[48,1],[50,0],[50,2],[51,0],[51,1],[55,0],[55,2],[56,0],[56,1],[60,0],[60,2],[61,0],[61,1],[64,1],[64,2],[70,1],[70,2]],
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
"use strict";
var $0 = $$.length - 1;
switch (yystate) {
case 1: return $$[$0-1];
break;
case 2:this.$ = new yy.Program($$[$0], null, {}, yy.locInfo(this._$));
break;
case 3:this.$ = $$[$0];
break;
case 4:this.$ = $$[$0];
break;
case 5:this.$ = $$[$0];
break;
case 6:this.$ = $$[$0];
break;
case 7:this.$ = $$[$0];
break;
case 8:this.$ = new yy.CommentStatement(yy.stripComment($$[$0]), yy.stripFlags($$[$0], $$[$0]), yy.locInfo(this._$));
break;
case 9:this.$ = new yy.ContentStatement($$[$0], yy.locInfo(this._$));
break;
case 10:this.$ = yy.prepareRawBlock($$[$0-2], $$[$0-1], $$[$0], this._$);
break;
case 11:this.$ = { path: $$[$0-3], params: $$[$0-2], hash: $$[$0-1] };
break;
case 12:this.$ = yy.prepareBlock($$[$0-3], $$[$0-2], $$[$0-1], $$[$0], false, this._$);
break;
case 13:this.$ = yy.prepareBlock($$[$0-3], $$[$0-2], $$[$0-1], $$[$0], true, this._$);
break;
case 14:this.$ = { path: $$[$0-4], params: $$[$0-3], hash: $$[$0-2], blockParams: $$[$0-1], strip: yy.stripFlags($$[$0-5], $$[$0]) };
break;
case 15:this.$ = { path: $$[$0-4], params: $$[$0-3], hash: $$[$0-2], blockParams: $$[$0-1], strip: yy.stripFlags($$[$0-5], $$[$0]) };
break;
case 16:this.$ = { path: $$[$0-4], params: $$[$0-3], hash: $$[$0-2], blockParams: $$[$0-1], strip: yy.stripFlags($$[$0-5], $$[$0]) };
break;
case 17:this.$ = { strip: yy.stripFlags($$[$0-1], $$[$0-1]), program: $$[$0] };
break;
case 18:
var inverse = yy.prepareBlock($$[$0-2], $$[$0-1], $$[$0], $$[$0], false, this._$),
program = new yy.Program([inverse], null, {}, yy.locInfo(this._$));
program.chained = true;
var handlebars = (function () {
var parser = { trace: function trace() {},
yy: {},
symbols_: { error: 2, root: 3, program: 4, EOF: 5, program_repetition0: 6, statement: 7, mustache: 8, block: 9, rawBlock: 10, partial: 11, content: 12, COMMENT: 13, CONTENT: 14, openRawBlock: 15, END_RAW_BLOCK: 16, OPEN_RAW_BLOCK: 17, helperName: 18, openRawBlock_repetition0: 19, openRawBlock_option0: 20, CLOSE_RAW_BLOCK: 21, openBlock: 22, block_option0: 23, closeBlock: 24, openInverse: 25, block_option1: 26, OPEN_BLOCK: 27, openBlock_repetition0: 28, openBlock_option0: 29, openBlock_option1: 30, CLOSE: 31, OPEN_INVERSE: 32, openInverse_repetition0: 33, openInverse_option0: 34, openInverse_option1: 35, openInverseChain: 36, OPEN_INVERSE_CHAIN: 37, openInverseChain_repetition0: 38, openInverseChain_option0: 39, openInverseChain_option1: 40, inverseAndProgram: 41, INVERSE: 42, inverseChain: 43, inverseChain_option0: 44, OPEN_ENDBLOCK: 45, OPEN: 46, mustache_repetition0: 47, mustache_option0: 48, OPEN_UNESCAPED: 49, mustache_repetition1: 50, mustache_option1: 51, CLOSE_UNESCAPED: 52, OPEN_PARTIAL: 53, partialName: 54, partial_repetition0: 55, partial_option0: 56, param: 57, sexpr: 58, OPEN_SEXPR: 59, sexpr_repetition0: 60, sexpr_option0: 61, CLOSE_SEXPR: 62, hash: 63, hash_repetition_plus0: 64, hashSegment: 65, ID: 66, EQUALS: 67, blockParams: 68, OPEN_BLOCK_PARAMS: 69, blockParams_repetition_plus0: 70, CLOSE_BLOCK_PARAMS: 71, path: 72, dataName: 73, STRING: 74, NUMBER: 75, BOOLEAN: 76, UNDEFINED: 77, NULL: 78, DATA: 79, pathSegments: 80, SEP: 81, $accept: 0, $end: 1 },
terminals_: { 2: "error", 5: "EOF", 13: "COMMENT", 14: "CONTENT", 16: "END_RAW_BLOCK", 17: "OPEN_RAW_BLOCK", 21: "CLOSE_RAW_BLOCK", 27: "OPEN_BLOCK", 31: "CLOSE", 32: "OPEN_INVERSE", 37: "OPEN_INVERSE_CHAIN", 42: "INVERSE", 45: "OPEN_ENDBLOCK", 46: "OPEN", 49: "OPEN_UNESCAPED", 52: "CLOSE_UNESCAPED", 53: "OPEN_PARTIAL", 59: "OPEN_SEXPR", 62: "CLOSE_SEXPR", 66: "ID", 67: "EQUALS", 69: "OPEN_BLOCK_PARAMS", 71: "CLOSE_BLOCK_PARAMS", 74: "STRING", 75: "NUMBER", 76: "BOOLEAN", 77: "UNDEFINED", 78: "NULL", 79: "DATA", 81: "SEP" },
productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [12, 1], [10, 3], [15, 5], [9, 4], [9, 4], [22, 6], [25, 6], [36, 6], [41, 2], [43, 3], [43, 1], [24, 3], [8, 5], [8, 5], [11, 5], [57, 1], [57, 1], [58, 5], [63, 1], [65, 3], [68, 3], [18, 1], [18, 1], [18, 1], [18, 1], [18, 1], [18, 1], [18, 1], [54, 1], [54, 1], [73, 2], [72, 1], [80, 3], [80, 1], [6, 0], [6, 2], [19, 0], [19, 2], [20, 0], [20, 1], [23, 0], [23, 1], [26, 0], [26, 1], [28, 0], [28, 2], [29, 0], [29, 1], [30, 0], [30, 1], [33, 0], [33, 2], [34, 0], [34, 1], [35, 0], [35, 1], [38, 0], [38, 2], [39, 0], [39, 1], [40, 0], [40, 1], [44, 0], [44, 1], [47, 0], [47, 2], [48, 0], [48, 1], [50, 0], [50, 2], [51, 0], [51, 1], [55, 0], [55, 2], [56, 0], [56, 1], [60, 0], [60, 2], [61, 0], [61, 1], [64, 1], [64, 2], [70, 1], [70, 2]],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
this.$ = { strip: $$[$0-2].strip, program: program, chain: true };
break;
case 19:this.$ = $$[$0];
break;
case 20:this.$ = {path: $$[$0-1], strip: yy.stripFlags($$[$0-2], $$[$0])};
break;
case 21:this.$ = yy.prepareMustache($$[$0-3], $$[$0-2], $$[$0-1], $$[$0-4], yy.stripFlags($$[$0-4], $$[$0]), this._$);
break;
case 22:this.$ = yy.prepareMustache($$[$0-3], $$[$0-2], $$[$0-1], $$[$0-4], yy.stripFlags($$[$0-4], $$[$0]), this._$);
break;
case 23:this.$ = new yy.PartialStatement($$[$0-3], $$[$0-2], $$[$0-1], yy.stripFlags($$[$0-4], $$[$0]), yy.locInfo(this._$));
break;
case 24:this.$ = $$[$0];
break;
case 25:this.$ = $$[$0];
break;
case 26:this.$ = new yy.SubExpression($$[$0-3], $$[$0-2], $$[$0-1], yy.locInfo(this._$));
break;
case 27:this.$ = new yy.Hash($$[$0], yy.locInfo(this._$));
break;
case 28:this.$ = new yy.HashPair($$[$0-2], $$[$0], yy.locInfo(this._$));
break;
case 29:this.$ = $$[$0-1];
break;
case 30:this.$ = $$[$0];
break;
case 31:this.$ = $$[$0];
break;
case 32:this.$ = new yy.StringLiteral($$[$0], yy.locInfo(this._$));
break;
case 33:this.$ = new yy.NumberLiteral($$[$0], yy.locInfo(this._$));
break;
case 34:this.$ = new yy.BooleanLiteral($$[$0], yy.locInfo(this._$));
break;
case 35:this.$ = $$[$0];
break;
case 36:this.$ = $$[$0];
break;
case 37:this.$ = yy.preparePath(true, $$[$0], this._$);
break;
case 38:this.$ = yy.preparePath(false, $$[$0], this._$);
break;
case 39: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2];
break;
case 40:this.$ = [{part: $$[$0]}];
break;
case 41:this.$ = [];
break;
case 42:$$[$0-1].push($$[$0]);
break;
case 43:this.$ = [];
break;
case 44:$$[$0-1].push($$[$0]);
break;
case 51:this.$ = [];
break;
case 52:$$[$0-1].push($$[$0]);
break;
case 57:this.$ = [];
break;
case 58:$$[$0-1].push($$[$0]);
break;
case 63:this.$ = [];
break;
case 64:$$[$0-1].push($$[$0]);
break;
case 71:this.$ = [];
break;
case 72:$$[$0-1].push($$[$0]);
break;
case 75:this.$ = [];
break;
case 76:$$[$0-1].push($$[$0]);
break;
case 79:this.$ = [];
break;
case 80:$$[$0-1].push($$[$0]);
break;
case 83:this.$ = [];
break;
case 84:$$[$0-1].push($$[$0]);
break;
case 87:this.$ = [$$[$0]];
break;
case 88:$$[$0-1].push($$[$0]);
break;
case 89:this.$ = [$$[$0]];
break;
case 90:$$[$0-1].push($$[$0]);
break;
}
},
table: [{3:1,4:2,5:[2,41],6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],46:[2,41],49:[2,41],53:[2,41]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:[1,11],14:[1,18],15:16,17:[1,21],22:14,25:15,27:[1,19],32:[1,20],37:[2,2],42:[2,2],45:[2,2],46:[1,12],49:[1,13],53:[1,17]},{1:[2,1]},{5:[2,42],13:[2,42],14:[2,42],17:[2,42],27:[2,42],32:[2,42],37:[2,42],42:[2,42],45:[2,42],46:[2,42],49:[2,42],53:[2,42]},{5:[2,3],13:[2,3],14:[2,3],17:[2,3],27:[2,3],32:[2,3],37:[2,3],42:[2,3],45:[2,3],46:[2,3],49:[2,3],53:[2,3]},{5:[2,4],13:[2,4],14:[2,4],17:[2,4],27:[2,4],32:[2,4],37:[2,4],42:[2,4],45:[2,4],46:[2,4],49:[2,4],53:[2,4]},{5:[2,5],13:[2,5],14:[2,5],17:[2,5],27:[2,5],32:[2,5],37:[2,5],42:[2,5],45:[2,5],46:[2,5],49:[2,5],53:[2,5]},{5:[2,6],13:[2,6],14:[2,6],17:[2,6],27:[2,6],32:[2,6],37:[2,6],42:[2,6],45:[2,6],46:[2,6],49:[2,6],53:[2,6]},{5:[2,7],13:[2,7],14:[2,7],17:[2,7],27:[2,7],32:[2,7],37:[2,7],42:[2,7],45:[2,7],46:[2,7],49:[2,7],53:[2,7]},{5:[2,8],13:[2,8],14:[2,8],17:[2,8],27:[2,8],32:[2,8],37:[2,8],42:[2,8],45:[2,8],46:[2,8],49:[2,8],53:[2,8]},{18:22,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:31,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{4:32,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],37:[2,41],42:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{4:33,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],42:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{12:34,14:[1,18]},{18:36,54:35,58:37,59:[1,38],66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{5:[2,9],13:[2,9],14:[2,9],16:[2,9],17:[2,9],27:[2,9],32:[2,9],37:[2,9],42:[2,9],45:[2,9],46:[2,9],49:[2,9],53:[2,9]},{18:39,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:40,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:41,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{31:[2,71],47:42,59:[2,71],66:[2,71],74:[2,71],75:[2,71],76:[2,71],77:[2,71]},{21:[2,30],31:[2,30],52:[2,30],59:[2,30],62:[2,30],66:[2,30],69:[2,30],74:[2,30],75:[2,30],76:[2,30],77:[2,30]},{21:[2,31],31:[2,31],52:[2,31],59:[2,31],62:[2,31],66:[2,31],69:[2,31],74:[2,31],75:[2,31],76:[2,31],77:[2,31]},{21:[2,32],31:[2,32],52:[2,32],59:[2,32],62:[2,32],66:[2,32],69:[2,32],74:[2,32],75:[2,32],76:[2,32],77:[2,32]},{21:[2,33],31:[2,33],52:[2,33],59:[2,33],62:[2,33],66:[2,33],69:[2,33],74:[2,33],75:[2,33],76:[2,33],77:[2,33]},{21:[2,34],31:[2,34],52:[2,34],59:[2,34],62:[2,34],66:[2,34],69:[2,34],74:[2,34],75:[2,34],76:[2,34],77:[2,34]},{21:[2,38],31:[2,38],52:[2,38],59:[2,38],62:[2,38],66:[2,38],69:[2,38],74:[2,38],75:[2,38],76:[2,38],77:[2,38],79:[1,43]},{66:[1,30],78:44},{21:[2,40],31:[2,40],52:[2,40],59:[2,40],62:[2,40],66:[2,40],69:[2,40],74:[2,40],75:[2,40],76:[2,40],77:[2,40],79:[2,40]},{50:45,52:[2,75],59:[2,75],66:[2,75],74:[2,75],75:[2,75],76:[2,75],77:[2,75]},{23:46,36:48,37:[1,50],41:49,42:[1,51],43:47,45:[2,47]},{26:52,41:53,42:[1,51],45:[2,49]},{16:[1,54]},{31:[2,79],55:55,59:[2,79],66:[2,79],74:[2,79],75:[2,79],76:[2,79],77:[2,79]},{31:[2,35],59:[2,35],66:[2,35],74:[2,35],75:[2,35],76:[2,35],77:[2,35]},{31:[2,36],59:[2,36],66:[2,36],74:[2,36],75:[2,36],76:[2,36],77:[2,36]},{18:56,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{28:57,31:[2,51],59:[2,51],66:[2,51],69:[2,51],74:[2,51],75:[2,51],76:[2,51],77:[2,51]},{31:[2,57],33:58,59:[2,57],66:[2,57],69:[2,57],74:[2,57],75:[2,57],76:[2,57],77:[2,57]},{19:59,21:[2,43],59:[2,43],66:[2,43],74:[2,43],75:[2,43],76:[2,43],77:[2,43]},{18:63,31:[2,73],48:60,57:61,58:64,59:[1,38],63:62,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{66:[1,68]},{21:[2,37],31:[2,37],52:[2,37],59:[2,37],62:[2,37],66:[2,37],69:[2,37],74:[2,37],75:[2,37],76:[2,37],77:[2,37],79:[1,43]},{18:63,51:69,52:[2,77],57:70,58:64,59:[1,38],63:71,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{24:72,45:[1,73]},{45:[2,48]},{4:74,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],37:[2,41],42:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{45:[2,19]},{18:75,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{4:76,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{24:77,45:[1,73]},{45:[2,50]},{5:[2,10],13:[2,10],14:[2,10],17:[2,10],27:[2,10],32:[2,10],37:[2,10],42:[2,10],45:[2,10],46:[2,10],49:[2,10],53:[2,10]},{18:63,31:[2,81],56:78,57:79,58:64,59:[1,38],63:80,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{59:[2,83],60:81,62:[2,83],66:[2,83],74:[2,83],75:[2,83],76:[2,83],77:[2,83]},{18:63,29:82,31:[2,53],57:83,58:64,59:[1,38],63:84,64:65,65:66,66:[1,67],69:[2,53],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:63,31:[2,59],34:85,57:86,58:64,59:[1,38],63:87,64:65,65:66,66:[1,67],69:[2,59],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:63,20:88,21:[2,45],57:89,58:64,59:[1,38],63:90,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{31:[1,91]},{31:[2,72],59:[2,72],66:[2,72],74:[2,72],75:[2,72],76:[2,72],77:[2,72]},{31:[2,74]},{21:[2,24],31:[2,24],52:[2,24],59:[2,24],62:[2,24],66:[2,24],69:[2,24],74:[2,24],75:[2,24],76:[2,24],77:[2,24]},{21:[2,25],31:[2,25],52:[2,25],59:[2,25],62:[2,25],66:[2,25],69:[2,25],74:[2,25],75:[2,25],76:[2,25],77:[2,25]},{21:[2,27],31:[2,27],52:[2,27],62:[2,27],65:92,66:[1,93],69:[2,27]},{21:[2,87],31:[2,87],52:[2,87],62:[2,87],66:[2,87],69:[2,87]},{21:[2,40],31:[2,40],52:[2,40],59:[2,40],62:[2,40],66:[2,40],67:[1,94],69:[2,40],74:[2,40],75:[2,40],76:[2,40],77:[2,40],79:[2,40]},{21:[2,39],31:[2,39],52:[2,39],59:[2,39],62:[2,39],66:[2,39],69:[2,39],74:[2,39],75:[2,39],76:[2,39],77:[2,39],79:[2,39]},{52:[1,95]},{52:[2,76],59:[2,76],66:[2,76],74:[2,76],75:[2,76],76:[2,76],77:[2,76]},{52:[2,78]},{5:[2,12],13:[2,12],14:[2,12],17:[2,12],27:[2,12],32:[2,12],37:[2,12],42:[2,12],45:[2,12],46:[2,12],49:[2,12],53:[2,12]},{18:96,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{36:48,37:[1,50],41:49,42:[1,51],43:98,44:97,45:[2,69]},{31:[2,63],38:99,59:[2,63],66:[2,63],69:[2,63],74:[2,63],75:[2,63],76:[2,63],77:[2,63]},{45:[2,17]},{5:[2,13],13:[2,13],14:[2,13],17:[2,13],27:[2,13],32:[2,13],37:[2,13],42:[2,13],45:[2,13],46:[2,13],49:[2,13],53:[2,13]},{31:[1,100]},{31:[2,80],59:[2,80],66:[2,80],74:[2,80],75:[2,80],76:[2,80],77:[2,80]},{31:[2,82]},{18:63,57:102,58:64,59:[1,38],61:101,62:[2,85],63:103,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{30:104,31:[2,55],68:105,69:[1,106]},{31:[2,52],59:[2,52],66:[2,52],69:[2,52],74:[2,52],75:[2,52],76:[2,52],77:[2,52]},{31:[2,54],69:[2,54]},{31:[2,61],35:107,68:108,69:[1,106]},{31:[2,58],59:[2,58],66:[2,58],69:[2,58],74:[2,58],75:[2,58],76:[2,58],77:[2,58]},{31:[2,60],69:[2,60]},{21:[1,109]},{21:[2,44],59:[2,44],66:[2,44],74:[2,44],75:[2,44],76:[2,44],77:[2,44]},{21:[2,46]},{5:[2,21],13:[2,21],14:[2,21],17:[2,21],27:[2,21],32:[2,21],37:[2,21],42:[2,21],45:[2,21],46:[2,21],49:[2,21],53:[2,21]},{21:[2,88],31:[2,88],52:[2,88],62:[2,88],66:[2,88],69:[2,88]},{67:[1,94]},{18:63,57:110,58:64,59:[1,38],66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{5:[2,22],13:[2,22],14:[2,22],17:[2,22],27:[2,22],32:[2,22],37:[2,22],42:[2,22],45:[2,22],46:[2,22],49:[2,22],53:[2,22]},{31:[1,111]},{45:[2,18]},{45:[2,70]},{18:63,31:[2,65],39:112,57:113,58:64,59:[1,38],63:114,64:65,65:66,66:[1,67],69:[2,65],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{5:[2,23],13:[2,23],14:[2,23],17:[2,23],27:[2,23],32:[2,23],37:[2,23],42:[2,23],45:[2,23],46:[2,23],49:[2,23],53:[2,23]},{62:[1,115]},{59:[2,84],62:[2,84],66:[2,84],74:[2,84],75:[2,84],76:[2,84],77:[2,84]},{62:[2,86]},{31:[1,116]},{31:[2,56]},{66:[1,118],70:117},{31:[1,119]},{31:[2,62]},{14:[2,11]},{21:[2,28],31:[2,28],52:[2,28],62:[2,28],66:[2,28],69:[2,28]},{5:[2,20],13:[2,20],14:[2,20],17:[2,20],27:[2,20],32:[2,20],37:[2,20],42:[2,20],45:[2,20],46:[2,20],49:[2,20],53:[2,20]},{31:[2,67],40:120,68:121,69:[1,106]},{31:[2,64],59:[2,64],66:[2,64],69:[2,64],74:[2,64],75:[2,64],76:[2,64],77:[2,64]},{31:[2,66],69:[2,66]},{21:[2,26],31:[2,26],52:[2,26],59:[2,26],62:[2,26],66:[2,26],69:[2,26],74:[2,26],75:[2,26],76:[2,26],77:[2,26]},{13:[2,14],14:[2,14],17:[2,14],27:[2,14],32:[2,14],37:[2,14],42:[2,14],45:[2,14],46:[2,14],49:[2,14],53:[2,14]},{66:[1,123],71:[1,122]},{66:[2,89],71:[2,89]},{13:[2,15],14:[2,15],17:[2,15],27:[2,15],32:[2,15],42:[2,15],45:[2,15],46:[2,15],49:[2,15],53:[2,15]},{31:[1,124]},{31:[2,68]},{31:[2,29]},{66:[2,90],71:[2,90]},{13:[2,16],14:[2,16],17:[2,16],27:[2,16],32:[2,16],37:[2,16],42:[2,16],45:[2,16],46:[2,16],49:[2,16],53:[2,16]}],
defaultActions: {4:[2,1],47:[2,48],49:[2,19],53:[2,50],62:[2,74],71:[2,78],76:[2,17],80:[2,82],90:[2,46],97:[2,18],98:[2,70],103:[2,86],105:[2,56],108:[2,62],109:[2,11],121:[2,68],122:[2,29]},
parseError: function parseError(str, hash) {
throw new Error(str);
},
parse: function parse(input) {
var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
this.lexer.setInput(input);
this.lexer.yy = this.yy;
this.yy.lexer = this.lexer;
this.yy.parser = this;
if (typeof this.lexer.yylloc == "undefined")
this.lexer.yylloc = {};
var yyloc = this.lexer.yylloc;
lstack.push(yyloc);
var ranges = this.lexer.options && this.lexer.options.ranges;
if (typeof this.yy.parseError === "function")
this.parseError = this.yy.parseError;
function popStack(n) {
stack.length = stack.length - 2 * n;
vstack.length = vstack.length - n;
lstack.length = lstack.length - n;
}
function lex() {
var token;
token = self.lexer.lex() || 1;
if (typeof token !== "number") {
token = self.symbols_[token] || token;
}
return token;
}
var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
while (true) {
state = stack[stack.length - 1];
if (this.defaultActions[state]) {
action = this.defaultActions[state];
} else {
if (symbol === null || typeof symbol == "undefined") {
symbol = lex();
var $0 = $$.length - 1;
switch (yystate) {
case 1:
return $$[$0 - 1];
break;
case 2:
this.$ = new yy.Program($$[$0], null, {}, yy.locInfo(this._$));
break;
case 3:
this.$ = $$[$0];
break;
case 4:
this.$ = $$[$0];
break;
case 5:
this.$ = $$[$0];
break;
case 6:
this.$ = $$[$0];
break;
case 7:
this.$ = $$[$0];
break;
case 8:
this.$ = new yy.CommentStatement(yy.stripComment($$[$0]), yy.stripFlags($$[$0], $$[$0]), yy.locInfo(this._$));
break;
case 9:
this.$ = new yy.ContentStatement($$[$0], yy.locInfo(this._$));
break;
case 10:
this.$ = yy.prepareRawBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$);
break;
case 11:
this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1] };
break;
case 12:
this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], false, this._$);
break;
case 13:
this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], true, this._$);
break;
case 14:
this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) };
break;
case 15:
this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) };
break;
case 16:
this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) };
break;
case 17:
this.$ = { strip: yy.stripFlags($$[$0 - 1], $$[$0 - 1]), program: $$[$0] };
break;
case 18:
var inverse = yy.prepareBlock($$[$0 - 2], $$[$0 - 1], $$[$0], $$[$0], false, this._$),
program = new yy.Program([inverse], null, {}, yy.locInfo(this._$));
program.chained = true;
this.$ = { strip: $$[$0 - 2].strip, program: program, chain: true };
break;
case 19:
this.$ = $$[$0];
break;
case 20:
this.$ = { path: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 2], $$[$0]) };
break;
case 21:
this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$);
break;
case 22:
this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$);
break;
case 23:
this.$ = new yy.PartialStatement($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], yy.stripFlags($$[$0 - 4], $$[$0]), yy.locInfo(this._$));
break;
case 24:
this.$ = $$[$0];
break;
case 25:
this.$ = $$[$0];
break;
case 26:
this.$ = new yy.SubExpression($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], yy.locInfo(this._$));
break;
case 27:
this.$ = new yy.Hash($$[$0], yy.locInfo(this._$));
break;
case 28:
this.$ = new yy.HashPair(yy.id($$[$0 - 2]), $$[$0], yy.locInfo(this._$));
break;
case 29:
this.$ = yy.id($$[$0 - 1]);
break;
case 30:
this.$ = $$[$0];
break;
case 31:
this.$ = $$[$0];
break;
case 32:
this.$ = new yy.StringLiteral($$[$0], yy.locInfo(this._$));
break;
case 33:
this.$ = new yy.NumberLiteral($$[$0], yy.locInfo(this._$));
break;
case 34:
this.$ = new yy.BooleanLiteral($$[$0], yy.locInfo(this._$));
break;
case 35:
this.$ = new yy.UndefinedLiteral(yy.locInfo(this._$));
break;
case 36:
this.$ = new yy.NullLiteral(yy.locInfo(this._$));
break;
case 37:
this.$ = $$[$0];
break;
case 38:
this.$ = $$[$0];
break;
case 39:
this.$ = yy.preparePath(true, $$[$0], this._$);
break;
case 40:
this.$ = yy.preparePath(false, $$[$0], this._$);
break;
case 41:
$$[$0 - 2].push({ part: yy.id($$[$0]), original: $$[$0], separator: $$[$0 - 1] });this.$ = $$[$0 - 2];
break;
case 42:
this.$ = [{ part: yy.id($$[$0]), original: $$[$0] }];
break;
case 43:
this.$ = [];
break;
case 44:
$$[$0 - 1].push($$[$0]);
break;
case 45:
this.$ = [];
break;
case 46:
$$[$0 - 1].push($$[$0]);
break;
case 53:
this.$ = [];
break;
case 54:
$$[$0 - 1].push($$[$0]);
break;
case 59:
this.$ = [];
break;
case 60:
$$[$0 - 1].push($$[$0]);
break;
case 65:
this.$ = [];
break;
case 66:
$$[$0 - 1].push($$[$0]);
break;
case 73:
this.$ = [];
break;
case 74:
$$[$0 - 1].push($$[$0]);
break;
case 77:
this.$ = [];
break;
case 78:
$$[$0 - 1].push($$[$0]);
break;
case 81:
this.$ = [];
break;
case 82:
$$[$0 - 1].push($$[$0]);
break;
case 85:
this.$ = [];
break;
case 86:
$$[$0 - 1].push($$[$0]);
break;
case 89:
this.$ = [$$[$0]];
break;
case 90:
$$[$0 - 1].push($$[$0]);
break;
case 91:
this.$ = [$$[$0]];
break;
case 92:
$$[$0 - 1].push($$[$0]);
break;
}
action = table[state] && table[state][symbol];
}
if (typeof action === "undefined" || !action.length || !action[0]) {
var errStr = "";
if (!recovering) {
expected = [];
for (p in table[state])
if (this.terminals_[p] && p > 2) {
expected.push("'" + this.terminals_[p] + "'");
},
table: [{ 3: 1, 4: 2, 5: [2, 43], 6: 3, 13: [2, 43], 14: [2, 43], 17: [2, 43], 27: [2, 43], 32: [2, 43], 46: [2, 43], 49: [2, 43], 53: [2, 43] }, { 1: [3] }, { 5: [1, 4] }, { 5: [2, 2], 7: 5, 8: 6, 9: 7, 10: 8, 11: 9, 12: 10, 13: [1, 11], 14: [1, 18], 15: 16, 17: [1, 21], 22: 14, 25: 15, 27: [1, 19], 32: [1, 20], 37: [2, 2], 42: [2, 2], 45: [2, 2], 46: [1, 12], 49: [1, 13], 53: [1, 17] }, { 1: [2, 1] }, { 5: [2, 44], 13: [2, 44], 14: [2, 44], 17: [2, 44], 27: [2, 44], 32: [2, 44], 37: [2, 44], 42: [2, 44], 45: [2, 44], 46: [2, 44], 49: [2, 44], 53: [2, 44] }, { 5: [2, 3], 13: [2, 3], 14: [2, 3], 17: [2, 3], 27: [2, 3], 32: [2, 3], 37: [2, 3], 42: [2, 3], 45: [2, 3], 46: [2, 3], 49: [2, 3], 53: [2, 3] }, { 5: [2, 4], 13: [2, 4], 14: [2, 4], 17: [2, 4], 27: [2, 4], 32: [2, 4], 37: [2, 4], 42: [2, 4], 45: [2, 4], 46: [2, 4], 49: [2, 4], 53: [2, 4] }, { 5: [2, 5], 13: [2, 5], 14: [2, 5], 17: [2, 5], 27: [2, 5], 32: [2, 5], 37: [2, 5], 42: [2, 5], 45: [2, 5], 46: [2, 5], 49: [2, 5], 53: [2, 5] }, { 5: [2, 6], 13: [2, 6], 14: [2, 6], 17: [2, 6], 27: [2, 6], 32: [2, 6], 37: [2, 6], 42: [2, 6], 45: [2, 6], 46: [2, 6], 49: [2, 6], 53: [2, 6] }, { 5: [2, 7], 13: [2, 7], 14: [2, 7], 17: [2, 7], 27: [2, 7], 32: [2, 7], 37: [2, 7], 42: [2, 7], 45: [2, 7], 46: [2, 7], 49: [2, 7], 53: [2, 7] }, { 5: [2, 8], 13: [2, 8], 14: [2, 8], 17: [2, 8], 27: [2, 8], 32: [2, 8], 37: [2, 8], 42: [2, 8], 45: [2, 8], 46: [2, 8], 49: [2, 8], 53: [2, 8] }, { 18: 22, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 18: 33, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 4: 34, 6: 3, 13: [2, 43], 14: [2, 43], 17: [2, 43], 27: [2, 43], 32: [2, 43], 37: [2, 43], 42: [2, 43], 45: [2, 43], 46: [2, 43], 49: [2, 43], 53: [2, 43] }, { 4: 35, 6: 3, 13: [2, 43], 14: [2, 43], 17: [2, 43], 27: [2, 43], 32: [2, 43], 42: [2, 43], 45: [2, 43], 46: [2, 43], 49: [2, 43], 53: [2, 43] }, { 12: 36, 14: [1, 18] }, { 18: 38, 54: 37, 58: 39, 59: [1, 40], 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 5: [2, 9], 13: [2, 9], 14: [2, 9], 16: [2, 9], 17: [2, 9], 27: [2, 9], 32: [2, 9], 37: [2, 9], 42: [2, 9], 45: [2, 9], 46: [2, 9], 49: [2, 9], 53: [2, 9] }, { 18: 41, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 18: 42, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 18: 43, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 31: [2, 73], 47: 44, 59: [2, 73], 66: [2, 73], 74: [2, 73], 75: [2, 73], 76: [2, 73], 77: [2, 73], 78: [2, 73], 79: [2, 73] }, { 21: [2, 30], 31: [2, 30], 52: [2, 30], 59: [2, 30], 62: [2, 30], 66: [2, 30], 69: [2, 30], 74: [2, 30], 75: [2, 30], 76: [2, 30], 77: [2, 30], 78: [2, 30], 79: [2, 30] }, { 21: [2, 31], 31: [2, 31], 52: [2, 31], 59: [2, 31], 62: [2, 31], 66: [2, 31], 69: [2, 31], 74: [2, 31], 75: [2, 31], 76: [2, 31], 77: [2, 31], 78: [2, 31], 79: [2, 31] }, { 21: [2, 32], 31: [2, 32], 52: [2, 32], 59: [2, 32], 62: [2, 32], 66: [2, 32], 69: [2, 32], 74: [2, 32], 75: [2, 32], 76: [2, 32], 77: [2, 32], 78: [2, 32], 79: [2, 32] }, { 21: [2, 33], 31: [2, 33], 52: [2, 33], 59: [2, 33], 62: [2, 33], 66: [2, 33], 69: [2, 33], 74: [2, 33], 75: [2, 33], 76: [2, 33], 77: [2, 33], 78: [2, 33], 79: [2, 33] }, { 21: [2, 34], 31: [2, 34], 52: [2, 34], 59: [2, 34], 62: [2, 34], 66: [2, 34], 69: [2, 34], 74: [2, 34], 75: [2, 34], 76: [2, 34], 77: [2, 34], 78: [2, 34], 79: [2, 34] }, { 21: [2, 35], 31: [2, 35], 52: [2, 35], 59: [2, 35], 62: [2, 35], 66: [2, 35], 69: [2, 35], 74: [2, 35], 75: [2, 35], 76: [2, 35], 77: [2, 35], 78: [2, 35], 79: [2, 35] }, { 21: [2, 36], 31: [2, 36], 52: [2, 36], 59: [2, 36], 62: [2, 36], 66: [2, 36], 69: [2, 36], 74: [2, 36], 75: [2, 36], 76: [2, 36], 77: [2, 36], 78: [2, 36], 79: [2, 36] }, { 21: [2, 40], 31: [2, 40], 52: [2, 40], 59: [2, 40], 62: [2, 40], 66: [2, 40], 69: [2, 40], 74: [2, 40], 75: [2, 40], 76: [2, 40], 77: [2, 40], 78: [2, 40], 79: [2, 40], 81: [1, 45] }, { 66: [1, 32], 80: 46 }, { 21: [2, 42], 31: [2, 42], 52: [2, 42], 59: [2, 42], 62: [2, 42], 66: [2, 42], 69: [2, 42], 74: [2, 42], 75: [2, 42], 76: [2, 42], 77: [2, 42], 78: [2, 42], 79: [2, 42], 81: [2, 42] }, { 50: 47, 52: [2, 77], 59: [2, 77], 66: [2, 77], 74: [2, 77], 75: [2, 77], 76: [2, 77], 77: [2, 77], 78: [2, 77], 79: [2, 77] }, { 23: 48, 36: 50, 37: [1, 52], 41: 51, 42: [1, 53], 43: 49, 45: [2, 49] }, { 26: 54, 41: 55, 42: [1, 53], 45: [2, 51] }, { 16: [1, 56] }, { 31: [2, 81], 55: 57, 59: [2, 81], 66: [2, 81], 74: [2, 81], 75: [2, 81], 76: [2, 81], 77: [2, 81], 78: [2, 81], 79: [2, 81] }, { 31: [2, 37], 59: [2, 37], 66: [2, 37], 74: [2, 37], 75: [2, 37], 76: [2, 37], 77: [2, 37], 78: [2, 37], 79: [2, 37] }, { 31: [2, 38], 59: [2, 38], 66: [2, 38], 74: [2, 38], 75: [2, 38], 76: [2, 38], 77: [2, 38], 78: [2, 38], 79: [2, 38] }, { 18: 58, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 28: 59, 31: [2, 53], 59: [2, 53], 66: [2, 53], 69: [2, 53], 74: [2, 53], 75: [2, 53], 76: [2, 53], 77: [2, 53], 78: [2, 53], 79: [2, 53] }, { 31: [2, 59], 33: 60, 59: [2, 59], 66: [2, 59], 69: [2, 59], 74: [2, 59], 75: [2, 59], 76: [2, 59], 77: [2, 59], 78: [2, 59], 79: [2, 59] }, { 19: 61, 21: [2, 45], 59: [2, 45], 66: [2, 45], 74: [2, 45], 75: [2, 45], 76: [2, 45], 77: [2, 45], 78: [2, 45], 79: [2, 45] }, { 18: 65, 31: [2, 75], 48: 62, 57: 63, 58: 66, 59: [1, 40], 63: 64, 64: 67, 65: 68, 66: [1, 69], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 66: [1, 70] }, { 21: [2, 39], 31: [2, 39], 52: [2, 39], 59: [2, 39], 62: [2, 39], 66: [2, 39], 69: [2, 39], 74: [2, 39], 75: [2, 39], 76: [2, 39], 77: [2, 39], 78: [2, 39], 79: [2, 39], 81: [1, 45] }, { 18: 65, 51: 71, 52: [2, 79], 57: 72, 58: 66, 59: [1, 40], 63: 73, 64: 67, 65: 68, 66: [1, 69], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 24: 74, 45: [1, 75] }, { 45: [2, 50] }, { 4: 76, 6: 3, 13: [2, 43], 14: [2, 43], 17: [2, 43], 27: [2, 43], 32: [2, 43], 37: [2, 43], 42: [2, 43], 45: [2, 43], 46: [2, 43], 49: [2, 43], 53: [2, 43] }, { 45: [2, 19] }, { 18: 77, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 4: 78, 6: 3, 13: [2, 43], 14: [2, 43], 17: [2, 43], 27: [2, 43], 32: [2, 43], 45: [2, 43], 46: [2, 43], 49: [2, 43], 53: [2, 43] }, { 24: 79, 45: [1, 75] }, { 45: [2, 52] }, { 5: [2, 10], 13: [2, 10], 14: [2, 10], 17: [2, 10], 27: [2, 10], 32: [2, 10], 37: [2, 10], 42: [2, 10], 45: [2, 10], 46: [2, 10], 49: [2, 10], 53: [2, 10] }, { 18: 65, 31: [2, 83], 56: 80, 57: 81, 58: 66, 59: [1, 40], 63: 82, 64: 67, 65: 68, 66: [1, 69], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 59: [2, 85], 60: 83, 62: [2, 85], 66: [2, 85], 74: [2, 85], 75: [2, 85], 76: [2, 85], 77: [2, 85], 78: [2, 85], 79: [2, 85] }, { 18: 65, 29: 84, 31: [2, 55], 57: 85, 58: 66, 59: [1, 40], 63: 86, 64: 67, 65: 68, 66: [1, 69], 69: [2, 55], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 18: 65, 31: [2, 61], 34: 87, 57: 88, 58: 66, 59: [1, 40], 63: 89, 64: 67, 65: 68, 66: [1, 69], 69: [2, 61], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 18: 65, 20: 90, 21: [2, 47], 57: 91, 58: 66, 59: [1, 40], 63: 92, 64: 67, 65: 68, 66: [1, 69], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 31: [1, 93] }, { 31: [2, 74], 59: [2, 74], 66: [2, 74], 74: [2, 74], 75: [2, 74], 76: [2, 74], 77: [2, 74], 78: [2, 74], 79: [2, 74] }, { 31: [2, 76] }, { 21: [2, 24], 31: [2, 24], 52: [2, 24], 59: [2, 24], 62: [2, 24], 66: [2, 24], 69: [2, 24], 74: [2, 24], 75: [2, 24], 76: [2, 24], 77: [2, 24], 78: [2, 24], 79: [2, 24] }, { 21: [2, 25], 31: [2, 25], 52: [2, 25], 59: [2, 25], 62: [2, 25], 66: [2, 25], 69: [2, 25], 74: [2, 25], 75: [2, 25], 76: [2, 25], 77: [2, 25], 78: [2, 25], 79: [2, 25] }, { 21: [2, 27], 31: [2, 27], 52: [2, 27], 62: [2, 27], 65: 94, 66: [1, 95], 69: [2, 27] }, { 21: [2, 89], 31: [2, 89], 52: [2, 89], 62: [2, 89], 66: [2, 89], 69: [2, 89] }, { 21: [2, 42], 31: [2, 42], 52: [2, 42], 59: [2, 42], 62: [2, 42], 66: [2, 42], 67: [1, 96], 69: [2, 42], 74: [2, 42], 75: [2, 42], 76: [2, 42], 77: [2, 42], 78: [2, 42], 79: [2, 42], 81: [2, 42] }, { 21: [2, 41], 31: [2, 41], 52: [2, 41], 59: [2, 41], 62: [2, 41], 66: [2, 41], 69: [2, 41], 74: [2, 41], 75: [2, 41], 76: [2, 41], 77: [2, 41], 78: [2, 41], 79: [2, 41], 81: [2, 41] }, { 52: [1, 97] }, { 52: [2, 78], 59: [2, 78], 66: [2, 78], 74: [2, 78], 75: [2, 78], 76: [2, 78], 77: [2, 78], 78: [2, 78], 79: [2, 78] }, { 52: [2, 80] }, { 5: [2, 12], 13: [2, 12], 14: [2, 12], 17: [2, 12], 27: [2, 12], 32: [2, 12], 37: [2, 12], 42: [2, 12], 45: [2, 12], 46: [2, 12], 49: [2, 12], 53: [2, 12] }, { 18: 98, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 36: 50, 37: [1, 52], 41: 51, 42: [1, 53], 43: 100, 44: 99, 45: [2, 71] }, { 31: [2, 65], 38: 101, 59: [2, 65], 66: [2, 65], 69: [2, 65], 74: [2, 65], 75: [2, 65], 76: [2, 65], 77: [2, 65], 78: [2, 65], 79: [2, 65] }, { 45: [2, 17] }, { 5: [2, 13], 13: [2, 13], 14: [2, 13], 17: [2, 13], 27: [2, 13], 32: [2, 13], 37: [2, 13], 42: [2, 13], 45: [2, 13], 46: [2, 13], 49: [2, 13], 53: [2, 13] }, { 31: [1, 102] }, { 31: [2, 82], 59: [2, 82], 66: [2, 82], 74: [2, 82], 75: [2, 82], 76: [2, 82], 77: [2, 82], 78: [2, 82], 79: [2, 82] }, { 31: [2, 84] }, { 18: 65, 57: 104, 58: 66, 59: [1, 40], 61: 103, 62: [2, 87], 63: 105, 64: 67, 65: 68, 66: [1, 69], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 30: 106, 31: [2, 57], 68: 107, 69: [1, 108] }, { 31: [2, 54], 59: [2, 54], 66: [2, 54], 69: [2, 54], 74: [2, 54], 75: [2, 54], 76: [2, 54], 77: [2, 54], 78: [2, 54], 79: [2, 54] }, { 31: [2, 56], 69: [2, 56] }, { 31: [2, 63], 35: 109, 68: 110, 69: [1, 108] }, { 31: [2, 60], 59: [2, 60], 66: [2, 60], 69: [2, 60], 74: [2, 60], 75: [2, 60], 76: [2, 60], 77: [2, 60], 78: [2, 60], 79: [2, 60] }, { 31: [2, 62], 69: [2, 62] }, { 21: [1, 111] }, { 21: [2, 46], 59: [2, 46], 66: [2, 46], 74: [2, 46], 75: [2, 46], 76: [2, 46], 77: [2, 46], 78: [2, 46], 79: [2, 46] }, { 21: [2, 48] }, { 5: [2, 21], 13: [2, 21], 14: [2, 21], 17: [2, 21], 27: [2, 21], 32: [2, 21], 37: [2, 21], 42: [2, 21], 45: [2, 21], 46: [2, 21], 49: [2, 21], 53: [2, 21] }, { 21: [2, 90], 31: [2, 90], 52: [2, 90], 62: [2, 90], 66: [2, 90], 69: [2, 90] }, { 67: [1, 96] }, { 18: 65, 57: 112, 58: 66, 59: [1, 40], 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 5: [2, 22], 13: [2, 22], 14: [2, 22], 17: [2, 22], 27: [2, 22], 32: [2, 22], 37: [2, 22], 42: [2, 22], 45: [2, 22], 46: [2, 22], 49: [2, 22], 53: [2, 22] }, { 31: [1, 113] }, { 45: [2, 18] }, { 45: [2, 72] }, { 18: 65, 31: [2, 67], 39: 114, 57: 115, 58: 66, 59: [1, 40], 63: 116, 64: 67, 65: 68, 66: [1, 69], 69: [2, 67], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 5: [2, 23], 13: [2, 23], 14: [2, 23], 17: [2, 23], 27: [2, 23], 32: [2, 23], 37: [2, 23], 42: [2, 23], 45: [2, 23], 46: [2, 23], 49: [2, 23], 53: [2, 23] }, { 62: [1, 117] }, { 59: [2, 86], 62: [2, 86], 66: [2, 86], 74: [2, 86], 75: [2, 86], 76: [2, 86], 77: [2, 86], 78: [2, 86], 79: [2, 86] }, { 62: [2, 88] }, { 31: [1, 118] }, { 31: [2, 58] }, { 66: [1, 120], 70: 119 }, { 31: [1, 121] }, { 31: [2, 64] }, { 14: [2, 11] }, { 21: [2, 28], 31: [2, 28], 52: [2, 28], 62: [2, 28], 66: [2, 28], 69: [2, 28] }, { 5: [2, 20], 13: [2, 20], 14: [2, 20], 17: [2, 20], 27: [2, 20], 32: [2, 20], 37: [2, 20], 42: [2, 20], 45: [2, 20], 46: [2, 20], 49: [2, 20], 53: [2, 20] }, { 31: [2, 69], 40: 122, 68: 123, 69: [1, 108] }, { 31: [2, 66], 59: [2, 66], 66: [2, 66], 69: [2, 66], 74: [2, 66], 75: [2, 66], 76: [2, 66], 77: [2, 66], 78: [2, 66], 79: [2, 66] }, { 31: [2, 68], 69: [2, 68] }, { 21: [2, 26], 31: [2, 26], 52: [2, 26], 59: [2, 26], 62: [2, 26], 66: [2, 26], 69: [2, 26], 74: [2, 26], 75: [2, 26], 76: [2, 26], 77: [2, 26], 78: [2, 26], 79: [2, 26] }, { 13: [2, 14], 14: [2, 14], 17: [2, 14], 27: [2, 14], 32: [2, 14], 37: [2, 14], 42: [2, 14], 45: [2, 14], 46: [2, 14], 49: [2, 14], 53: [2, 14] }, { 66: [1, 125], 71: [1, 124] }, { 66: [2, 91], 71: [2, 91] }, { 13: [2, 15], 14: [2, 15], 17: [2, 15], 27: [2, 15], 32: [2, 15], 42: [2, 15], 45: [2, 15], 46: [2, 15], 49: [2, 15], 53: [2, 15] }, { 31: [1, 126] }, { 31: [2, 70] }, { 31: [2, 29] }, { 66: [2, 92], 71: [2, 92] }, { 13: [2, 16], 14: [2, 16], 17: [2, 16], 27: [2, 16], 32: [2, 16], 37: [2, 16], 42: [2, 16], 45: [2, 16], 46: [2, 16], 49: [2, 16], 53: [2, 16] }],
defaultActions: { 4: [2, 1], 49: [2, 50], 51: [2, 19], 55: [2, 52], 64: [2, 76], 73: [2, 80], 78: [2, 17], 82: [2, 84], 92: [2, 48], 99: [2, 18], 100: [2, 72], 105: [2, 88], 107: [2, 58], 110: [2, 64], 111: [2, 11], 123: [2, 70], 124: [2, 29] },
parseError: function parseError(str, hash) {
throw new Error(str);
},
parse: function parse(input) {
var self = this,
stack = [0],
vstack = [null],
lstack = [],
table = this.table,
yytext = "",
yylineno = 0,
yyleng = 0,
recovering = 0,
TERROR = 2,
EOF = 1;
this.lexer.setInput(input);
this.lexer.yy = this.yy;
this.yy.lexer = this.lexer;
this.yy.parser = this;
if (typeof this.lexer.yylloc == "undefined") this.lexer.yylloc = {};
var yyloc = this.lexer.yylloc;
lstack.push(yyloc);
var ranges = this.lexer.options && this.lexer.options.ranges;
if (typeof this.yy.parseError === "function") this.parseError = this.yy.parseError;
function popStack(n) {
stack.length = stack.length - 2 * n;
vstack.length = vstack.length - n;
lstack.length = lstack.length - n;
}
function lex() {
var token;
token = self.lexer.lex() || 1;
if (typeof token !== "number") {
token = self.symbols_[token] || token;
}
return token;
}
var symbol,
preErrorSymbol,
state,
action,
a,
r,
yyval = {},
p,
len,
newState,
expected;
while (true) {
state = stack[stack.length - 1];
if (this.defaultActions[state]) {
action = this.defaultActions[state];
} else {
if (symbol === null || typeof symbol == "undefined") {
symbol = lex();
}
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) + "'");
action = table[state] && table[state][symbol];
}
this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});
if (typeof action === "undefined" || !action.length || !action[0]) {
var errStr = "";
if (!recovering) {
expected = [];
for (p in table[state]) if (this.terminals_[p] && p > 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;
}
}
}
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;
}
};
/* 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]++;
};
/* 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 setInput(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 input() {
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 = this._input.slice(1);
return ch;
},
unput: function unput(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);
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;
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
};
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;
if (this.options.ranges) {
this.yylloc.range = [r[0], r[0] + this.yyleng - len];
}
return this;
},
more: function more() {
this._more = true;
return this;
},
less: function less(n) {
this.unput(this.match.slice(n));
},
pastInput: function pastInput() {
var past = this.matched.substr(0, this.matched.length - this.match.length);
return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
},
upcomingInput: function upcomingInput() {
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 showPosition() {
var pre = this.pastInput();
var c = new Array(pre.length + 1).join("-");
return pre + this.upcomingInput() + "\n" + c + "^";
},
next: function next() {
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;
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 topState() {
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);
}
}
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) {
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;
function strip(start, end) {
return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng-end);
}
break;
case 3:
yy_.yytext = yy_.yytext.substr(5, yy_.yyleng - 9);
this.popState();
return 16;
break;
case 4:
return 14;
break;
case 5:
this.popState();
return 13;
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:
yy_.yytext = yy_.yytext.substr(5, yy_.yyleng-9);
this.popState();
return 16;
break;
case 4: return 14;
break;
case 5:
this.popState();
return 13;
break;
case 6:
return 59;
break;
case 7:
return 62;
break;
case 8:
return 17;
break;
case 9:
this.popState();
this.begin("raw");
return 21;
break;
case 6:return 59;
break;
case 7:return 62;
break;
case 8: return 17;
break;
case 9:
this.popState();
this.begin('raw');
return 21;
break;
case 10:return 53;
break;
case 11:return 27;
break;
case 12:return 45;
break;
case 13:this.popState(); return 42;
break;
case 14:this.popState(); return 42;
break;
case 15:return 32;
break;
case 16:return 37;
break;
case 17:return 49;
break;
case 18:return 46;
break;
case 19:
this.unput(yy_.yytext);
this.popState();
this.begin('com');
break;
case 10:
return 53;
break;
case 11:
return 27;
break;
case 12:
return 45;
break;
case 13:
this.popState();return 42;
break;
case 14:
this.popState();return 42;
break;
case 15:
return 32;
break;
case 16:
return 37;
break;
case 17:
return 49;
break;
case 18:
return 46;
break;
case 19:
this.unput(yy_.yytext);
this.popState();
this.begin("com");
break;
case 20:
this.popState();
return 13;
break;
case 20:
this.popState();
return 13;
break;
case 21:return 46;
break;
case 22:return 67;
break;
case 23:return 66;
break;
case 24:return 66;
break;
case 25:return 79;
break;
case 26:// ignore whitespace
break;
case 27:this.popState(); return 52;
break;
case 28:this.popState(); return 31;
break;
case 29:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 74;
break;
case 30:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 74;
break;
case 31:return 77;
break;
case 32:return 76;
break;
case 33:return 76;
break;
case 34:return 75;
break;
case 35:return 69;
break;
case 36:return 71;
break;
case 37:return 66;
break;
case 38:yy_.yytext = strip(1,2); return 66;
break;
case 39:return 'INVALID';
break;
case 40:return 5;
break;
}
};
lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/];
lexer.conditions = {"mu":{"rules":[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,33,34,35,36,37,38,39,40],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[5],"inclusive":false},"raw":{"rules":[3,4],"inclusive":false},"INITIAL":{"rules":[0,1,40],"inclusive":true}};
return lexer;})()
parser.lexer = lexer;
function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser;
return new Parser;
})();__exports__["default"] = handlebars;
break;
case 21:
return 46;
break;
case 22:
return 67;
break;
case 23:
return 66;
break;
case 24:
return 66;
break;
case 25:
return 81;
break;
case 26:
// ignore whitespace
break;
case 27:
this.popState();return 52;
break;
case 28:
this.popState();return 31;
break;
case 29:
yy_.yytext = strip(1, 2).replace(/\\"/g, "\"");return 74;
break;
case 30:
yy_.yytext = strip(1, 2).replace(/\\'/g, "'");return 74;
break;
case 31:
return 79;
break;
case 32:
return 76;
break;
case 33:
return 76;
break;
case 34:
return 77;
break;
case 35:
return 78;
break;
case 36:
return 75;
break;
case 37:
return 69;
break;
case 38:
return 71;
break;
case 39:
return 66;
break;
case 40:
return 66;
break;
case 41:
return "INVALID";
break;
case 42:
return 5;
break;
}
};
lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]*?(?=(\{\{\{\{\/)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[[^\]]*\])/, /^(?:.)/, /^(?:$)/];
lexer.conditions = { mu: { rules: [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, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42], inclusive: false }, emu: { rules: [2], inclusive: false }, com: { rules: [5], inclusive: false }, raw: { rules: [3, 4], inclusive: false }, INITIAL: { rules: [0, 1, 42], inclusive: true } };
return lexer;
})();
parser.lexer = lexer;
function Parser() {
this.yy = {};
}Parser.prototype = parser;parser.Parser = Parser;
return new Parser();
})();module.exports = handlebars;
/* jshint ignore:end */
});
});

@@ -1,144 +0,165 @@

define(
["./visitor","exports"],
function(__dependency1__, __exports__) {
"use strict";
var Visitor = __dependency1__["default"];
define(['exports', './visitor'], function (exports, _visitor) {
'use strict';
function print(ast) {
return new PrintVisitor().accept(ast);
}
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj['default'] : obj; };
__exports__.print = print;function PrintVisitor() {
this.padding = 0;
}
exports.__esModule = true;
exports.print = print;
exports.PrintVisitor = PrintVisitor;
/*eslint-disable new-cap */
__exports__.PrintVisitor = PrintVisitor;PrintVisitor.prototype = new Visitor();
var _Visitor = _interopRequire(_visitor);
PrintVisitor.prototype.pad = function(string) {
var out = "";
function print(ast) {
return new PrintVisitor().accept(ast);
}
for(var i=0,l=this.padding; i<l; i++) {
out = out + " ";
}
function PrintVisitor() {
this.padding = 0;
}
out = out + string + "\n";
return out;
};
PrintVisitor.prototype = new _Visitor();
PrintVisitor.prototype.Program = function(program) {
var out = '',
body = program.body,
i, l;
PrintVisitor.prototype.pad = function (string) {
var out = '';
if (program.blockParams) {
var blockParams = 'BLOCK PARAMS: [';
for(i=0, l=program.blockParams.length; i<l; i++) {
blockParams += ' ' + program.blockParams[i];
}
blockParams += ' ]';
out += this.pad(blockParams);
}
for (var i = 0, l = this.padding; i < l; i++) {
out = out + ' ';
}
for(i=0, l=body.length; i<l; i++) {
out = out + this.accept(body[i]);
out = out + string + '\n';
return out;
};
PrintVisitor.prototype.Program = function (program) {
var out = '',
body = program.body,
i = undefined,
l = undefined;
if (program.blockParams) {
var blockParams = 'BLOCK PARAMS: [';
for (i = 0, l = program.blockParams.length; i < l; i++) {
blockParams += ' ' + program.blockParams[i];
}
blockParams += ' ]';
out += this.pad(blockParams);
}
this.padding--;
for (i = 0, l = body.length; i < l; i++) {
out = out + this.accept(body[i]);
}
return out;
};
this.padding--;
PrintVisitor.prototype.MustacheStatement = function(mustache) {
return this.pad('{{ ' + this.SubExpression(mustache) + ' }}');
};
return out;
};
PrintVisitor.prototype.BlockStatement = function(block) {
var out = "";
PrintVisitor.prototype.MustacheStatement = function (mustache) {
return this.pad('{{ ' + this.SubExpression(mustache) + ' }}');
};
out = out + this.pad('BLOCK:');
PrintVisitor.prototype.BlockStatement = function (block) {
var out = '';
out = out + this.pad('BLOCK:');
this.padding++;
out = out + this.pad(this.SubExpression(block));
if (block.program) {
out = out + this.pad('PROGRAM:');
this.padding++;
out = out + this.pad(this.SubExpression(block));
out = out + this.accept(block.program);
this.padding--;
}
if (block.inverse) {
if (block.program) {
out = out + this.pad('PROGRAM:');
this.padding++;
out = out + this.accept(block.program);
this.padding--;
}
if (block.inverse) {
if (block.program) { this.padding++; }
out = out + this.pad('{{^}}');
this.padding++;
out = out + this.accept(block.inverse);
out = out + this.pad('{{^}}');
this.padding++;
out = out + this.accept(block.inverse);
this.padding--;
if (block.program) {
this.padding--;
if (block.program) { this.padding--; }
}
this.padding--;
}
this.padding--;
return out;
};
return out;
};
PrintVisitor.prototype.PartialStatement = function(partial) {
var content = 'PARTIAL:' + partial.name.original;
if(partial.params[0]) {
content += ' ' + this.accept(partial.params[0]);
}
if (partial.hash) {
content += ' ' + this.accept(partial.hash);
}
return this.pad('{{> ' + content + ' }}');
};
PrintVisitor.prototype.PartialStatement = function (partial) {
var content = 'PARTIAL:' + partial.name.original;
if (partial.params[0]) {
content += ' ' + this.accept(partial.params[0]);
}
if (partial.hash) {
content += ' ' + this.accept(partial.hash);
}
return this.pad('{{> ' + content + ' }}');
};
PrintVisitor.prototype.ContentStatement = function(content) {
return this.pad("CONTENT[ '" + content.value + "' ]");
};
PrintVisitor.prototype.ContentStatement = function (content) {
return this.pad('CONTENT[ \'' + content.value + '\' ]');
};
PrintVisitor.prototype.CommentStatement = function(comment) {
return this.pad("{{! '" + comment.value + "' }}");
};
PrintVisitor.prototype.CommentStatement = function (comment) {
return this.pad('{{! \'' + comment.value + '\' }}');
};
PrintVisitor.prototype.SubExpression = function(sexpr) {
var params = sexpr.params, paramStrings = [], hash;
PrintVisitor.prototype.SubExpression = function (sexpr) {
var params = sexpr.params,
paramStrings = [],
hash = undefined;
for(var i=0, l=params.length; i<l; i++) {
paramStrings.push(this.accept(params[i]));
}
for (var i = 0, l = params.length; i < l; i++) {
paramStrings.push(this.accept(params[i]));
}
params = "[" + paramStrings.join(", ") + "]";
params = '[' + paramStrings.join(', ') + ']';
hash = sexpr.hash ? " " + this.accept(sexpr.hash) : "";
hash = sexpr.hash ? ' ' + this.accept(sexpr.hash) : '';
return this.accept(sexpr.path) + " " + params + hash;
};
return this.accept(sexpr.path) + ' ' + params + hash;
};
PrintVisitor.prototype.PathExpression = function(id) {
var path = id.parts.join('/');
return (id.data ? '@' : '') + 'PATH:' + path;
};
PrintVisitor.prototype.PathExpression = function (id) {
var path = id.parts.join('/');
return (id.data ? '@' : '') + 'PATH:' + path;
};
PrintVisitor.prototype.StringLiteral = function (string) {
return '"' + string.value + '"';
};
PrintVisitor.prototype.StringLiteral = function(string) {
return '"' + string.value + '"';
};
PrintVisitor.prototype.NumberLiteral = function (number) {
return 'NUMBER{' + number.value + '}';
};
PrintVisitor.prototype.NumberLiteral = function(number) {
return "NUMBER{" + number.value + "}";
};
PrintVisitor.prototype.BooleanLiteral = function (bool) {
return 'BOOLEAN{' + bool.value + '}';
};
PrintVisitor.prototype.BooleanLiteral = function(bool) {
return "BOOLEAN{" + bool.value + "}";
};
PrintVisitor.prototype.UndefinedLiteral = function () {
return 'UNDEFINED';
};
PrintVisitor.prototype.Hash = function(hash) {
var pairs = hash.pairs;
var joinedPairs = [];
PrintVisitor.prototype.NullLiteral = function () {
return 'NULL';
};
for (var i=0, l=pairs.length; i<l; i++) {
joinedPairs.push(this.accept(pairs[i]));
}
PrintVisitor.prototype.Hash = function (hash) {
var pairs = hash.pairs,
joinedPairs = [];
return 'HASH{' + joinedPairs.join(', ') + '}';
};
PrintVisitor.prototype.HashPair = function(pair) {
return pair.key + '=' + this.accept(pair.value);
};
});
for (var i = 0, l = pairs.length; i < l; i++) {
joinedPairs.push(this.accept(pairs[i]));
}
return 'HASH{' + joinedPairs.join(', ') + '}';
};
PrintVisitor.prototype.HashPair = function (pair) {
return pair.key + '=' + this.accept(pair.value);
};
/*eslint-enable new-cap */
});

@@ -1,127 +0,127 @@

define(
["../exception","./ast","exports"],
function(__dependency1__, __dependency2__, __exports__) {
"use strict";
var Exception = __dependency1__["default"];
var AST = __dependency2__["default"];
define(['exports', 'module', '../exception', './ast'], function (exports, module, _exception, _ast) {
'use strict';
function Visitor() {
this.parents = [];
}
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj['default'] : obj; };
Visitor.prototype = {
constructor: Visitor,
mutating: false,
var _Exception = _interopRequire(_exception);
// Visits a given value. If mutating, will replace the value if necessary.
acceptKey: function(node, name) {
var value = this.accept(node[name]);
if (this.mutating) {
// Hacky sanity check:
if (value && (!value.type || !AST[value.type])) {
throw new Exception('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type);
}
node[name] = value;
}
},
var _AST = _interopRequire(_ast);
// Performs an accept operation with added sanity check to ensure
// required keys are not removed.
acceptRequired: function(node, name) {
this.acceptKey(node, name);
function Visitor() {
this.parents = [];
}
if (!node[name]) {
throw new Exception(node.type + ' requires ' + name);
Visitor.prototype = {
constructor: Visitor,
mutating: false,
// Visits a given value. If mutating, will replace the value if necessary.
acceptKey: function acceptKey(node, name) {
var value = this.accept(node[name]);
if (this.mutating) {
// Hacky sanity check:
if (value && (!value.type || !_AST[value.type])) {
throw new _Exception('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type);
}
},
node[name] = value;
}
},
// Traverses a given array. If mutating, empty respnses will be removed
// for child elements.
acceptArray: function(array) {
for (var i = 0, l = array.length; i < l; i++) {
this.acceptKey(array, i);
// Performs an accept operation with added sanity check to ensure
// required keys are not removed.
acceptRequired: function acceptRequired(node, name) {
this.acceptKey(node, name);
if (!array[i]) {
array.splice(i, 1);
i--;
l--;
}
}
},
if (!node[name]) {
throw new _Exception(node.type + ' requires ' + name);
}
},
accept: function(object) {
if (!object) {
return;
}
// Traverses a given array. If mutating, empty respnses will be removed
// for child elements.
acceptArray: function acceptArray(array) {
for (var i = 0, l = array.length; i < l; i++) {
this.acceptKey(array, i);
if (this.current) {
this.parents.unshift(this.current);
if (!array[i]) {
array.splice(i, 1);
i--;
l--;
}
this.current = object;
}
},
var ret = this[object.type](object);
accept: function accept(object) {
if (!object) {
return;
}
this.current = this.parents.shift();
if (this.current) {
this.parents.unshift(this.current);
}
this.current = object;
if (!this.mutating || ret) {
return ret;
} else if (ret !== false) {
return object;
}
},
var ret = this[object.type](object);
Program: function(program) {
this.acceptArray(program.body);
},
this.current = this.parents.shift();
MustacheStatement: function(mustache) {
this.acceptRequired(mustache, 'path');
this.acceptArray(mustache.params);
this.acceptKey(mustache, 'hash');
},
if (!this.mutating || ret) {
return ret;
} else if (ret !== false) {
return object;
}
},
BlockStatement: function(block) {
this.acceptRequired(block, 'path');
this.acceptArray(block.params);
this.acceptKey(block, 'hash');
Program: function Program(program) {
this.acceptArray(program.body);
},
this.acceptKey(block, 'program');
this.acceptKey(block, 'inverse');
},
MustacheStatement: function MustacheStatement(mustache) {
this.acceptRequired(mustache, 'path');
this.acceptArray(mustache.params);
this.acceptKey(mustache, 'hash');
},
PartialStatement: function(partial) {
this.acceptRequired(partial, 'name');
this.acceptArray(partial.params);
this.acceptKey(partial, 'hash');
},
BlockStatement: function BlockStatement(block) {
this.acceptRequired(block, 'path');
this.acceptArray(block.params);
this.acceptKey(block, 'hash');
ContentStatement: function(/* content */) {},
CommentStatement: function(/* comment */) {},
this.acceptKey(block, 'program');
this.acceptKey(block, 'inverse');
},
SubExpression: function(sexpr) {
this.acceptRequired(sexpr, 'path');
this.acceptArray(sexpr.params);
this.acceptKey(sexpr, 'hash');
},
PartialExpression: function(partial) {
this.acceptRequired(partial, 'name');
this.acceptArray(partial.params);
this.acceptKey(partial, 'hash');
},
PartialStatement: function PartialStatement(partial) {
this.acceptRequired(partial, 'name');
this.acceptArray(partial.params);
this.acceptKey(partial, 'hash');
},
PathExpression: function(/* path */) {},
ContentStatement: function ContentStatement() {},
CommentStatement: function CommentStatement() {},
StringLiteral: function(/* string */) {},
NumberLiteral: function(/* number */) {},
BooleanLiteral: function(/* bool */) {},
SubExpression: function SubExpression(sexpr) {
this.acceptRequired(sexpr, 'path');
this.acceptArray(sexpr.params);
this.acceptKey(sexpr, 'hash');
},
Hash: function(hash) {
this.acceptArray(hash.pairs);
},
HashPair: function(pair) {
this.acceptRequired(pair, 'value');
}
};
PathExpression: function PathExpression() {},
__exports__["default"] = Visitor;
});
StringLiteral: function StringLiteral() {},
NumberLiteral: function NumberLiteral() {},
BooleanLiteral: function BooleanLiteral() {},
UndefinedLiteral: function UndefinedLiteral() {},
NullLiteral: function NullLiteral() {},
Hash: function Hash(hash) {
this.acceptArray(hash.pairs);
},
HashPair: function HashPair(pair) {
this.acceptRequired(pair, 'value');
}
};
module.exports = Visitor;
});
/* content */ /* comment */ /* path */ /* string */ /* number */ /* bool */ /* literal */ /* literal */

@@ -1,216 +0,209 @@

define(
["./visitor","exports"],
function(__dependency1__, __exports__) {
"use strict";
var Visitor = __dependency1__["default"];
define(['exports', 'module', './visitor'], function (exports, module, _visitor) {
'use strict';
function WhitespaceControl() {
}
WhitespaceControl.prototype = new Visitor();
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj['default'] : obj; };
WhitespaceControl.prototype.Program = function(program) {
var isRoot = !this.isRootSeen;
this.isRootSeen = true;
var _Visitor = _interopRequire(_visitor);
var body = program.body;
for (var i = 0, l = body.length; i < l; i++) {
var current = body[i],
strip = this.accept(current);
function WhitespaceControl() {}
WhitespaceControl.prototype = new _Visitor();
if (!strip) {
continue;
}
WhitespaceControl.prototype.Program = function (program) {
var isRoot = !this.isRootSeen;
this.isRootSeen = true;
var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot),
_isNextWhitespace = isNextWhitespace(body, i, isRoot),
var body = program.body;
for (var i = 0, l = body.length; i < l; i++) {
var current = body[i],
strip = this.accept(current);
openStandalone = strip.openStandalone && _isPrevWhitespace,
closeStandalone = strip.closeStandalone && _isNextWhitespace,
inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace;
if (!strip) {
continue;
}
if (strip.close) {
omitRight(body, i, true);
}
if (strip.open) {
omitLeft(body, i, true);
}
var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot),
_isNextWhitespace = isNextWhitespace(body, i, isRoot),
openStandalone = strip.openStandalone && _isPrevWhitespace,
closeStandalone = strip.closeStandalone && _isNextWhitespace,
inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace;
if (inlineStandalone) {
omitRight(body, i);
if (strip.close) {
omitRight(body, i, true);
}
if (strip.open) {
omitLeft(body, i, true);
}
if (omitLeft(body, i)) {
// If we are on a standalone node, save the indent info for partials
if (current.type === 'PartialStatement') {
// Pull out the whitespace from the final line
current.indent = (/([ \t]+$)/).exec(body[i-1].original)[1];
}
if (inlineStandalone) {
omitRight(body, i);
if (omitLeft(body, i)) {
// If we are on a standalone node, save the indent info for partials
if (current.type === 'PartialStatement') {
// Pull out the whitespace from the final line
current.indent = /([ \t]+$)/.exec(body[i - 1].original)[1];
}
}
if (openStandalone) {
omitRight((current.program || current.inverse).body);
}
if (openStandalone) {
omitRight((current.program || current.inverse).body);
// Strip out the previous content node if it's whitespace only
omitLeft(body, i);
}
if (closeStandalone) {
// Always strip the next node
omitRight(body, i);
// Strip out the previous content node if it's whitespace only
omitLeft(body, i);
}
if (closeStandalone) {
// Always strip the next node
omitRight(body, i);
omitLeft((current.inverse || current.program).body);
}
omitLeft((current.inverse || current.program).body);
}
}
return program;
};
WhitespaceControl.prototype.BlockStatement = function(block) {
this.accept(block.program);
this.accept(block.inverse);
return program;
};
WhitespaceControl.prototype.BlockStatement = function (block) {
this.accept(block.program);
this.accept(block.inverse);
// Find the inverse program that is involed with whitespace stripping.
var program = block.program || block.inverse,
inverse = block.program && block.inverse,
firstInverse = inverse,
lastInverse = inverse;
// Find the inverse program that is involed with whitespace stripping.
var program = block.program || block.inverse,
inverse = block.program && block.inverse,
firstInverse = inverse,
lastInverse = inverse;
if (inverse && inverse.chained) {
firstInverse = inverse.body[0].program;
if (inverse && inverse.chained) {
firstInverse = inverse.body[0].program;
// Walk the inverse chain to find the last inverse that is actually in the chain.
while (lastInverse.chained) {
lastInverse = lastInverse.body[lastInverse.body.length-1].program;
}
// Walk the inverse chain to find the last inverse that is actually in the chain.
while (lastInverse.chained) {
lastInverse = lastInverse.body[lastInverse.body.length - 1].program;
}
}
var strip = {
open: block.openStrip.open,
close: block.closeStrip.close,
var strip = {
open: block.openStrip.open,
close: block.closeStrip.close,
// Determine the standalone candiacy. Basically flag our content as being possibly standalone
// so our parent can determine if we actually are standalone
openStandalone: isNextWhitespace(program.body),
closeStandalone: isPrevWhitespace((firstInverse || program).body)
};
// Determine the standalone candiacy. Basically flag our content as being possibly standalone
// so our parent can determine if we actually are standalone
openStandalone: isNextWhitespace(program.body),
closeStandalone: isPrevWhitespace((firstInverse || program).body)
};
if (block.openStrip.close) {
omitRight(program.body, null, true);
}
if (block.openStrip.close) {
omitRight(program.body, null, true);
}
if (inverse) {
var inverseStrip = block.inverseStrip;
if (inverse) {
var inverseStrip = block.inverseStrip;
if (inverseStrip.open) {
omitLeft(program.body, null, true);
}
if (inverseStrip.open) {
omitLeft(program.body, null, true);
}
if (inverseStrip.close) {
omitRight(firstInverse.body, null, true);
}
if (block.closeStrip.open) {
omitLeft(lastInverse.body, null, true);
}
if (inverseStrip.close) {
omitRight(firstInverse.body, null, true);
}
if (block.closeStrip.open) {
omitLeft(lastInverse.body, null, true);
}
// Find standalone else statments
if (isPrevWhitespace(program.body)
&& isNextWhitespace(firstInverse.body)) {
omitLeft(program.body);
omitRight(firstInverse.body);
}
} else {
if (block.closeStrip.open) {
omitLeft(program.body, null, true);
}
// Find standalone else statments
if (isPrevWhitespace(program.body) && isNextWhitespace(firstInverse.body)) {
omitLeft(program.body);
omitRight(firstInverse.body);
}
} else if (block.closeStrip.open) {
omitLeft(program.body, null, true);
}
return strip;
};
return strip;
};
WhitespaceControl.prototype.MustacheStatement = function(mustache) {
return mustache.strip;
};
WhitespaceControl.prototype.MustacheStatement = function (mustache) {
return mustache.strip;
};
WhitespaceControl.prototype.PartialStatement =
WhitespaceControl.prototype.CommentStatement = function(node) {
/* istanbul ignore next */
var strip = node.strip || {};
return {
inlineStandalone: true,
open: strip.open,
close: strip.close
};
WhitespaceControl.prototype.PartialStatement = WhitespaceControl.prototype.CommentStatement = function (node) {
/* istanbul ignore next */
var strip = node.strip || {};
return {
inlineStandalone: true,
open: strip.open,
close: strip.close
};
};
function isPrevWhitespace(body, i, isRoot) {
if (i === undefined) {
i = body.length;
}
function isPrevWhitespace(body, i, isRoot) {
if (i === undefined) {
i = body.length;
}
// Nodes that end with newlines are considered whitespace (but are special
// cased for strip operations)
var prev = body[i - 1],
sibling = body[i - 2];
if (!prev) {
return isRoot;
}
// Nodes that end with newlines are considered whitespace (but are special
// cased for strip operations)
var prev = body[i-1],
sibling = body[i-2];
if (!prev) {
return isRoot;
}
if (prev.type === 'ContentStatement') {
return (sibling || !isRoot ? /\r?\n\s*?$/ : /(^|\r?\n)\s*?$/).test(prev.original);
}
}
function isNextWhitespace(body, i, isRoot) {
if (i === undefined) {
i = -1;
}
if (prev.type === 'ContentStatement') {
return (sibling || !isRoot ? (/\r?\n\s*?$/) : (/(^|\r?\n)\s*?$/)).test(prev.original);
}
var next = body[i + 1],
sibling = body[i + 2];
if (!next) {
return isRoot;
}
function isNextWhitespace(body, i, isRoot) {
if (i === undefined) {
i = -1;
}
var next = body[i+1],
sibling = body[i+2];
if (!next) {
return isRoot;
}
if (next.type === 'ContentStatement') {
return (sibling || !isRoot ? /^\s*?\r?\n/ : /^\s*?(\r?\n|$)/).test(next.original);
}
}
if (next.type === 'ContentStatement') {
return (sibling || !isRoot ? (/^\s*?\r?\n/) : (/^\s*?(\r?\n|$)/)).test(next.original);
}
// Marks the node to the right of the position as omitted.
// I.e. {{foo}}' ' will mark the ' ' node as omitted.
//
// If i is undefined, then the first child will be marked as such.
//
// If mulitple is truthy then all whitespace will be stripped out until non-whitespace
// content is met.
function omitRight(body, i, multiple) {
var current = body[i == null ? 0 : i + 1];
if (!current || current.type !== 'ContentStatement' || !multiple && current.rightStripped) {
return;
}
// Marks the node to the right of the position as omitted.
// I.e. {{foo}}' ' will mark the ' ' node as omitted.
//
// If i is undefined, then the first child will be marked as such.
//
// If mulitple is truthy then all whitespace will be stripped out until non-whitespace
// content is met.
function omitRight(body, i, multiple) {
var current = body[i == null ? 0 : i + 1];
if (!current || current.type !== 'ContentStatement' || (!multiple && current.rightStripped)) {
return;
}
var original = current.value;
current.value = current.value.replace(multiple ? /^\s+/ : /^[ \t]*\r?\n?/, '');
current.rightStripped = current.value !== original;
}
var original = current.value;
current.value = current.value.replace(multiple ? (/^\s+/) : (/^[ \t]*\r?\n?/), '');
current.rightStripped = current.value !== original;
// Marks the node to the left of the position as omitted.
// I.e. ' '{{foo}} will mark the ' ' node as omitted.
//
// If i is undefined then the last child will be marked as such.
//
// If mulitple is truthy then all whitespace will be stripped out until non-whitespace
// content is met.
function omitLeft(body, i, multiple) {
var current = body[i == null ? body.length - 1 : i - 1];
if (!current || current.type !== 'ContentStatement' || !multiple && current.leftStripped) {
return;
}
// Marks the node to the left of the position as omitted.
// I.e. ' '{{foo}} will mark the ' ' node as omitted.
//
// If i is undefined then the last child will be marked as such.
//
// If mulitple is truthy then all whitespace will be stripped out until non-whitespace
// content is met.
function omitLeft(body, i, multiple) {
var current = body[i == null ? body.length - 1 : i - 1];
if (!current || current.type !== 'ContentStatement' || (!multiple && current.leftStripped)) {
return;
}
// We omit the last node if it's whitespace only and not preceeded by a non-content node.
var original = current.value;
current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, '');
current.leftStripped = current.value !== original;
return current.leftStripped;
}
// We omit the last node if it's whitespace only and not preceeded by a non-content node.
var original = current.value;
current.value = current.value.replace(multiple ? (/\s+$/) : (/[ \t]+$/), '');
current.leftStripped = current.value !== original;
return current.leftStripped;
}
__exports__["default"] = WhitespaceControl;
});
module.exports = WhitespaceControl;
});

@@ -1,35 +0,37 @@

define(
["exports"],
function(__exports__) {
"use strict";
define(['exports', 'module'], function (exports, module) {
'use strict';
var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
function Exception(message, node) {
var loc = node && node.loc,
line,
column;
if (loc) {
line = loc.start.line;
column = loc.start.column;
function Exception(message, node) {
var loc = node && node.loc,
line = undefined,
column = undefined;
if (loc) {
line = loc.start.line;
column = loc.start.column;
message += ' - ' + line + ':' + column;
}
message += ' - ' + line + ':' + column;
}
var tmp = Error.prototype.constructor.call(this, message);
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]];
}
// 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 (loc) {
this.lineNumber = line;
this.column = column;
}
if (Error.captureStackTrace) {
Error.captureStackTrace(this, Exception);
}
Exception.prototype = new Error();
if (loc) {
this.lineNumber = line;
this.column = column;
}
}
__exports__["default"] = Exception;
});
Exception.prototype = new Error();
module.exports = Exception;
});

@@ -1,224 +0,226 @@

define(
["./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;
var createFrame = __dependency3__.createFrame;
define(['exports', './utils', './exception', './base'], function (exports, _utils, _exception, _base) {
'use strict';
function checkRevision(compilerInfo) {
var compilerRevision = compilerInfo && compilerInfo[0] || 1,
currentRevision = COMPILER_REVISION;
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj['default'] : obj; };
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.__esModule = true;
exports.checkRevision = checkRevision;
__exports__.checkRevision = checkRevision;// TODO: Remove this line and break up compilePartial
// TODO: Remove this line and break up compilePartial
function template(templateSpec, env) {
/* istanbul ignore next */
if (!env) {
throw new Exception("No environment passed to template");
exports.template = template;
exports.wrapProgram = wrapProgram;
exports.resolvePartial = resolvePartial;
exports.invokePartial = invokePartial;
exports.noop = noop;
var _Exception = _interopRequire(_exception);
function checkRevision(compilerInfo) {
var compilerRevision = compilerInfo && compilerInfo[0] || 1,
currentRevision = _base.COMPILER_REVISION;
if (compilerRevision !== currentRevision) {
if (compilerRevision < currentRevision) {
var runtimeVersions = _base.REVISION_CHANGES[currentRevision],
compilerVersions = _base.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] + ').');
}
if (!templateSpec || !templateSpec.main) {
throw new Exception('Unknown template object: ' + typeof templateSpec);
}
}
}
// 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.
env.VM.checkRevision(templateSpec.compiler);
function template(templateSpec, env) {
/* istanbul ignore next */
if (!env) {
throw new _Exception('No environment passed to template');
}
if (!templateSpec || !templateSpec.main) {
throw new _Exception('Unknown template object: ' + typeof templateSpec);
}
var invokePartialWrapper = function(partial, context, options) {
if (options.hash) {
context = Utils.extend({}, context, options.hash);
}
// 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.
env.VM.checkRevision(templateSpec.compiler);
partial = env.VM.resolvePartial.call(this, partial, context, options);
var result = env.VM.invokePartial.call(this, partial, context, options);
function invokePartialWrapper(partial, context, options) {
if (options.hash) {
context = _utils.extend({}, context, options.hash);
}
if (result == null && env.compile) {
options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env);
result = options.partials[options.name](context, options);
}
if (result != null) {
if (options.indent) {
var lines = result.split('\n');
for (var i = 0, l = lines.length; i < l; i++) {
if (!lines[i] && i + 1 === l) {
break;
}
partial = env.VM.resolvePartial.call(this, partial, context, options);
var result = env.VM.invokePartial.call(this, partial, context, options);
lines[i] = options.indent + lines[i];
if (result == null && env.compile) {
options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env);
result = options.partials[options.name](context, options);
}
if (result != null) {
if (options.indent) {
var lines = result.split('\n');
for (var i = 0, l = lines.length; i < l; i++) {
if (!lines[i] && i + 1 === l) {
break;
}
result = lines.join('\n');
lines[i] = options.indent + lines[i];
}
return result;
} else {
throw new Exception("The partial " + options.name + " could not be compiled when running in runtime-only mode");
result = lines.join('\n');
}
};
return result;
} else {
throw new _Exception('The partial ' + options.name + ' could not be compiled when running in runtime-only mode');
}
}
// Just add water
var container = {
strict: function(obj, name) {
if (!(name in obj)) {
throw new Exception('"' + name + '" not defined in ' + obj);
// Just add water
var container = {
strict: function strict(obj, name) {
if (!(name in obj)) {
throw new _Exception('"' + name + '" not defined in ' + obj);
}
return obj[name];
},
lookup: function lookup(depths, name) {
var len = depths.length;
for (var i = 0; i < len; i++) {
if (depths[i] && depths[i][name] != null) {
return depths[i][name];
}
return obj[name];
},
lookup: function(depths, name) {
var len = depths.length;
for (var i = 0; i < len; i++) {
if (depths[i] && depths[i][name] != null) {
return depths[i][name];
}
}
},
lambda: function(current, context) {
return typeof current === 'function' ? current.call(context) : current;
},
}
},
lambda: function lambda(current, context) {
return typeof current === 'function' ? current.call(context) : current;
},
escapeExpression: Utils.escapeExpression,
invokePartial: invokePartialWrapper,
escapeExpression: _utils.escapeExpression,
invokePartial: invokePartialWrapper,
fn: function(i) {
return templateSpec[i];
},
fn: function fn(i) {
return templateSpec[i];
},
programs: [],
program: function(i, data, declaredBlockParams, blockParams, depths) {
var programWrapper = this.programs[i],
fn = this.fn(i);
if (data || depths || blockParams || declaredBlockParams) {
programWrapper = program(this, i, fn, data, declaredBlockParams, blockParams, depths);
} else if (!programWrapper) {
programWrapper = this.programs[i] = program(this, i, fn);
}
return programWrapper;
},
programs: [],
program: function program(i, data, declaredBlockParams, blockParams, depths) {
var programWrapper = this.programs[i],
fn = this.fn(i);
if (data || depths || blockParams || declaredBlockParams) {
programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths);
} else if (!programWrapper) {
programWrapper = this.programs[i] = wrapProgram(this, i, fn);
}
return programWrapper;
},
data: function(data, depth) {
while (data && depth--) {
data = data._parent;
}
return data;
},
merge: function(param, common) {
var ret = param || common;
data: function data(value, depth) {
while (value && depth--) {
value = value._parent;
}
return value;
},
merge: function merge(param, common) {
var obj = param || common;
if (param && common && (param !== common)) {
ret = Utils.extend({}, common, param);
}
if (param && common && param !== common) {
obj = _utils.extend({}, common, param);
}
return ret;
},
return obj;
},
noop: env.VM.noop,
compilerInfo: templateSpec.compiler
};
noop: env.VM.noop,
compilerInfo: templateSpec.compiler
};
var ret = function(context, options) {
options = options || {};
var data = options.data;
function ret(context) {
var options = arguments[1] === undefined ? {} : arguments[1];
ret._setup(options);
if (!options.partial && templateSpec.useData) {
data = initData(context, data);
}
var depths,
blockParams = templateSpec.useBlockParams ? [] : undefined;
if (templateSpec.useDepths) {
depths = options.depths ? [context].concat(options.depths) : [context];
}
var data = options.data;
return templateSpec.main.call(container, context, container.helpers, container.partials, data, blockParams, depths);
};
ret.isTop = true;
ret._setup(options);
if (!options.partial && templateSpec.useData) {
data = initData(context, data);
}
var depths = undefined,
blockParams = templateSpec.useBlockParams ? [] : undefined;
if (templateSpec.useDepths) {
depths = options.depths ? [context].concat(options.depths) : [context];
}
ret._setup = function(options) {
if (!options.partial) {
container.helpers = container.merge(options.helpers, env.helpers);
return templateSpec.main.call(container, context, container.helpers, container.partials, data, blockParams, depths);
}
ret.isTop = true;
if (templateSpec.usePartial) {
container.partials = container.merge(options.partials, env.partials);
}
} else {
container.helpers = options.helpers;
container.partials = options.partials;
}
};
ret._setup = function (options) {
if (!options.partial) {
container.helpers = container.merge(options.helpers, env.helpers);
ret._child = function(i, data, blockParams, depths) {
if (templateSpec.useBlockParams && !blockParams) {
throw new Exception('must pass block params');
if (templateSpec.usePartial) {
container.partials = container.merge(options.partials, env.partials);
}
if (templateSpec.useDepths && !depths) {
throw new Exception('must pass parent depths');
}
} else {
container.helpers = options.helpers;
container.partials = options.partials;
}
};
return program(container, i, templateSpec[i], data, 0, blockParams, depths);
};
return ret;
}
ret._child = function (i, data, blockParams, depths) {
if (templateSpec.useBlockParams && !blockParams) {
throw new _Exception('must pass block params');
}
if (templateSpec.useDepths && !depths) {
throw new _Exception('must pass parent depths');
}
__exports__.template = template;function program(container, i, fn, data, declaredBlockParams, blockParams, depths) {
var prog = function(context, options) {
options = options || {};
return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths);
};
return ret;
}
return fn.call(container,
context,
container.helpers, container.partials,
options.data || data,
blockParams && [options.blockParams].concat(blockParams),
depths && [context].concat(depths));
};
prog.program = i;
prog.depth = depths ? depths.length : 0;
prog.blockParams = declaredBlockParams || 0;
return prog;
function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) {
function prog(context) {
var options = arguments[1] === undefined ? {} : arguments[1];
return fn.call(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), depths && [context].concat(depths));
}
prog.program = i;
prog.depth = depths ? depths.length : 0;
prog.blockParams = declaredBlockParams || 0;
return prog;
}
__exports__.program = program;function resolvePartial(partial, context, options) {
if (!partial) {
partial = options.partials[options.name];
} else if (!partial.call && !options.name) {
// This is a dynamic partial that returned a string
options.name = partial;
partial = options.partials[partial];
}
return partial;
function resolvePartial(partial, context, options) {
if (!partial) {
partial = options.partials[options.name];
} else if (!partial.call && !options.name) {
// This is a dynamic partial that returned a string
options.name = partial;
partial = options.partials[partial];
}
return partial;
}
__exports__.resolvePartial = resolvePartial;function invokePartial(partial, context, options) {
options.partial = true;
function invokePartial(partial, context, options) {
options.partial = true;
if(partial === undefined) {
throw new Exception("The partial " + options.name + " could not be found");
} else if(partial instanceof Function) {
return partial(context, options);
}
if (partial === undefined) {
throw new _Exception('The partial ' + options.name + ' could not be found');
} else if (partial instanceof Function) {
return partial(context, options);
}
}
__exports__.invokePartial = invokePartial;function noop() { return ""; }
function noop() {
return '';
}
__exports__.noop = noop;function initData(context, data) {
if (!data || !('root' in data)) {
data = data ? createFrame(data) : {};
data.root = context;
}
return data;
function initData(context, data) {
if (!data || !('root' in data)) {
data = data ? _base.createFrame(data) : {};
data.root = context;
}
});
return data;
}
});

@@ -1,15 +0,14 @@

define(
["exports"],
function(__exports__) {
"use strict";
// Build out our basic SafeString type
function SafeString(string) {
this.string = string;
}
define(['exports', 'module'], function (exports, module) {
// Build out our basic SafeString type
'use strict';
SafeString.prototype.toString = SafeString.prototype.toHTML = function() {
return "" + this.string;
};
function SafeString(string) {
this.string = string;
}
__exports__["default"] = SafeString;
});
SafeString.prototype.toString = SafeString.prototype.toHTML = function () {
return '' + this.string;
};
module.exports = SafeString;
});

@@ -1,107 +0,117 @@

define(
["exports"],
function(__exports__) {
"use strict";
/*jshint -W004 */
var escape = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#x27;",
"`": "&#x60;"
};
define(['exports'], function (exports) {
'use strict';
var badChars = /[&<>"'`]/g;
var possible = /[&<>"'`]/;
exports.__esModule = true;
exports.extend = extend;
function escapeChar(chr) {
return escape[chr];
}
// Older IE versions do not directly support indexOf so we must implement our own, sadly.
exports.indexOf = indexOf;
exports.escapeExpression = escapeExpression;
exports.isEmpty = isEmpty;
exports.blockParams = blockParams;
exports.appendContextPath = appendContextPath;
/*jshint -W004 */
var escape = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
'\'': '&#x27;',
'`': '&#x60;'
};
function extend(obj /* , ...source */) {
for (var i = 1; i < arguments.length; i++) {
for (var key in arguments[i]) {
if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
obj[key] = arguments[i][key];
}
}
}
var badChars = /[&<>"'`]/g,
possible = /[&<>"'`]/;
return obj;
}
function escapeChar(chr) {
return escape[chr];
}
__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
/* istanbul ignore next */
if (isFunction(/x/)) {
isFunction = function(value) {
return typeof value === 'function' && toString.call(value) === '[object Function]';
};
}
var isFunction;
__exports__.isFunction = isFunction;
/* istanbul ignore next */
var isArray = Array.isArray || function(value) {
return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false;
};
__exports__.isArray = isArray;
// Older IE versions do not directly support indexOf so we must implement our own, sadly.
function indexOf(array, value) {
for (var i = 0, len = array.length; i < len; i++) {
if (array[i] === value) {
return i;
function extend(obj /* , ...source */) {
for (var i = 1; i < arguments.length; i++) {
for (var key in arguments[i]) {
if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
obj[key] = arguments[i][key];
}
}
return -1;
}
__exports__.indexOf = indexOf;
function escapeExpression(string) {
if (typeof string !== 'string') {
// don't escape SafeStrings, since they're already safe
if (string && string.toHTML) {
return string.toHTML();
} else if (string == null) {
return '';
} else if (!string) {
return string + '';
}
return obj;
}
// 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;
var toString = Object.prototype.toString;
exports.toString = toString;
// Sourced from lodash
// https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
/*eslint-disable func-style, no-var */
var isFunction = function isFunction(value) {
return typeof value === 'function';
};
// fallback for older versions of Chrome and Safari
/* istanbul ignore next */
if (isFunction(/x/)) {
exports.isFunction = isFunction = function (value) {
return typeof value === 'function' && toString.call(value) === '[object Function]';
};
}
var isFunction;
exports.isFunction = isFunction;
/*eslint-enable func-style, no-var */
/* istanbul ignore next */
var isArray = Array.isArray || function (value) {
return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false;
};exports.isArray = isArray;
function indexOf(array, value) {
for (var i = 0, len = array.length; i < len; i++) {
if (array[i] === value) {
return i;
}
if (!possible.test(string)) { return string; }
return string.replace(badChars, escapeChar);
}
return -1;
}
__exports__.escapeExpression = escapeExpression;function isEmpty(value) {
if (!value && value !== 0) {
return true;
} else if (isArray(value) && value.length === 0) {
return true;
} else {
return false;
function escapeExpression(string) {
if (typeof string !== 'string') {
// don't escape SafeStrings, since they're already safe
if (string && string.toHTML) {
return string.toHTML();
} else if (string == null) {
return '';
} else if (!string) {
return string + '';
}
// 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;
}
__exports__.isEmpty = isEmpty;function blockParams(params, ids) {
params.path = ids;
return params;
if (!possible.test(string)) {
return string;
}
return string.replace(badChars, escapeChar);
}
__exports__.blockParams = blockParams;function appendContextPath(contextPath, id) {
return (contextPath ? contextPath + '.' : '') + id;
function isEmpty(value) {
if (!value && value !== 0) {
return true;
} else if (isArray(value) && value.length === 0) {
return true;
} else {
return false;
}
}
__exports__.appendContextPath = appendContextPath;
});
function blockParams(params, ids) {
params.path = ids;
return params;
}
function appendContextPath(contextPath, id) {
return (contextPath ? contextPath + '.' : '') + id;
}
});

@@ -1,185 +0,184 @@

define(
[],
function() {
"use strict";
define(['exports', 'fs', './handlebars', 'path', 'source-map', 'uglify-js'], function (exports, _fs, _handlebars, _path, _sourceMap, _uglifyJs) {
'use strict';
var fs = require('fs'),
Handlebars = require('./index'),
basename = require('path').basename,
SourceMap = require('source-map'),
SourceMapConsumer = SourceMap.SourceMapConsumer,
SourceNode = SourceMap.SourceNode,
uglify = require('uglify-js');
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj['default'] : obj; };
module.exports.cli = function(opts) {
if (opts.version) {
console.log(Handlebars.VERSION);
return;
/*eslint-disable no-console */
var _fs2 = _interopRequire(_fs);
var _uglify = _interopRequire(_uglifyJs);
module.exports.cli = function (opts) {
if (opts.version) {
console.log(_handlebars.VERSION);
return;
}
if (!opts.templates.length) {
throw new _handlebars.Exception('Must define at least one template or directory.');
}
opts.templates.forEach(function (template) {
try {
_fs2.statSync(template);
} catch (err) {
throw new _handlebars.Exception('Unable to open template file "' + template + '"');
}
});
if (!opts.templates.length) {
throw new Handlebars.Exception('Must define at least one template or directory.');
if (opts.simple && opts.min) {
throw new _handlebars.Exception('Unable to minimize simple output');
}
if (opts.simple && (opts.templates.length !== 1 || _fs2.statSync(opts.templates[0]).isDirectory())) {
throw new _handlebars.Exception('Unable to output multiple templates in simple mode');
}
// Convert the known list into a hash
var known = {};
if (opts.known && !Array.isArray(opts.known)) {
opts.known = [opts.known];
}
if (opts.known) {
for (var i = 0, len = opts.known.length; i < len; i++) {
known[opts.known[i]] = true;
}
}
opts.templates.forEach(function(template) {
try {
fs.statSync(template);
} catch (err) {
throw new Handlebars.Exception('Unable to open template file "' + template + '"');
}
});
// Build file extension pattern
var extension = opts.extension.replace(/[\\^$*+?.():=!|{}\-\[\]]/g, function (arg) {
return '\\' + arg;
});
extension = new RegExp('\\.' + extension + '$');
if (opts.simple && opts.min) {
throw new Handlebars.Exception('Unable to minimize simple output');
var output = new _sourceMap.SourceNode();
if (!opts.simple) {
if (opts.amd) {
output.add('define([\'' + opts.handlebarPath + 'handlebars.runtime\'], function(Handlebars) {\n Handlebars = Handlebars["default"];');
} else if (opts.commonjs) {
output.add('var Handlebars = require("' + opts.commonjs + '");');
} else {
output.add('(function() {\n');
}
if (opts.simple && (opts.templates.length !== 1 || fs.statSync(opts.templates[0]).isDirectory())) {
throw new Handlebars.Exception('Unable to output multiple templates in simple mode');
output.add(' var template = Handlebars.template, templates = ');
if (opts.namespace) {
output.add(opts.namespace);
output.add(' = ');
output.add(opts.namespace);
output.add(' || ');
}
output.add('{};\n');
}
function processTemplate(template, root) {
var path = template,
stat = _fs2.statSync(path);
if (stat.isDirectory()) {
_fs2.readdirSync(template).map(function (file) {
var childPath = template + '/' + file;
// Convert the known list into a hash
var known = {};
if (opts.known && !Array.isArray(opts.known)) {
opts.known = [opts.known];
}
if (opts.known) {
for (var i = 0, len = opts.known.length; i < len; i++) {
known[opts.known[i]] = true;
if (extension.test(childPath) || _fs2.statSync(childPath).isDirectory()) {
processTemplate(childPath, root || template);
}
});
} else {
var data = _fs2.readFileSync(path, 'utf8');
if (opts.bom && data.indexOf('') === 0) {
data = data.substring(1);
}
}
// Build file extension pattern
var extension = opts.extension.replace(/[\\^$*+?.():=!|{}\-\[\]]/g, function(arg) { return '\\' + arg; });
extension = new RegExp('\\.' + extension + '$');
var options = {
knownHelpers: known,
knownHelpersOnly: opts.o
};
var output = new SourceNode();
if (!opts.simple) {
if (opts.amd) {
output.add('define([\'' + opts.handlebarPath + 'handlebars.runtime\'], function(Handlebars) {\n Handlebars = Handlebars["default"];');
} else if (opts.commonjs) {
output.add('var Handlebars = require("' + opts.commonjs + '");');
} else {
output.add('(function() {\n');
if (opts.map) {
options.srcName = path;
}
output.add(' var template = Handlebars.template, templates = ');
if (opts.namespace) {
output.add(opts.namespace);
output.add(' = ');
output.add(opts.namespace);
output.add(' || ');
if (opts.data) {
options.data = true;
}
output.add('{};\n');
}
function processTemplate(template, root) {
var path = template,
stat = fs.statSync(path);
if (stat.isDirectory()) {
fs.readdirSync(template).map(function(file) {
var path = template + '/' + file;
if (extension.test(path) || fs.statSync(path).isDirectory()) {
processTemplate(path, root || template);
}
});
} else {
var data = fs.readFileSync(path, 'utf8');
// Clean the template name
if (!root) {
template = _path.basename(template);
} else if (template.indexOf(root) === 0) {
template = template.substring(root.length + 1);
}
template = template.replace(extension, '');
if (opts.bom && data.indexOf('\uFEFF') === 0) {
data = data.substring(1);
}
var precompiled = _handlebars.precompile(data, options);
var options = {
knownHelpers: known,
knownHelpersOnly: opts.o
};
// If we are generating a source map, we have to reconstruct the SourceNode object
if (opts.map) {
var consumer = new _sourceMap.SourceMapConsumer(precompiled.map);
precompiled = _sourceMap.SourceNode.fromStringWithSourceMap(precompiled.code, consumer);
}
if (opts.map) {
options.srcName = path;
if (opts.simple) {
output.add([precompiled, '\n']);
} else if (opts.partial) {
if (opts.amd && (opts.templates.length == 1 && !_fs2.statSync(opts.templates[0]).isDirectory())) {
output.add('return ');
}
if (opts.data) {
options.data = true;
output.add(['Handlebars.partials[\'', template, '\'] = template(', precompiled, ');\n']);
} else {
if (opts.amd && (opts.templates.length == 1 && !_fs2.statSync(opts.templates[0]).isDirectory())) {
output.add('return ');
}
output.add(['templates[\'', template, '\'] = template(', precompiled, ');\n']);
}
}
}
// Clean the template name
if (!root) {
template = basename(template);
} else if (template.indexOf(root) === 0) {
template = template.substring(root.length+1);
}
template = template.replace(extension, '');
opts.templates.forEach(function (template) {
processTemplate(template, opts.root);
});
var precompiled = Handlebars.precompile(data, options);
// If we are generating a source map, we have to reconstruct the SourceNode object
if (opts.map) {
var consumer = new SourceMapConsumer(precompiled.map);
precompiled = SourceNode.fromStringWithSourceMap(precompiled.code, consumer);
}
if (opts.simple) {
output.add([precompiled, '\n']);
} else if (opts.partial) {
if(opts.amd && (opts.templates.length == 1 && !fs.statSync(opts.templates[0]).isDirectory())) {
output.add('return ');
}
output.add(['Handlebars.partials[\'', template, '\'] = template(', precompiled, ');\n']);
// Output the content
if (!opts.simple) {
if (opts.amd) {
if (opts.templates.length > 1 || opts.templates.length == 1 && _fs2.statSync(opts.templates[0]).isDirectory()) {
if (opts.partial) {
output.add('return Handlebars.partials;\n');
} else {
if(opts.amd && (opts.templates.length == 1 && !fs.statSync(opts.templates[0]).isDirectory())) {
output.add('return ');
}
output.add(['templates[\'', template, '\'] = template(', precompiled, ');\n']);
output.add('return templates;\n');
}
}
output.add('});');
} else if (!opts.commonjs) {
output.add('})();');
}
}
opts.templates.forEach(function(template) {
processTemplate(template, opts.root);
});
if (opts.map) {
output.add('\n//# sourceMappingURL=' + opts.map + '\n');
}
// Output the content
if (!opts.simple) {
if (opts.amd) {
if(opts.templates.length > 1 || (opts.templates.length == 1 && fs.statSync(opts.templates[0]).isDirectory())) {
if(opts.partial){
output.add('return Handlebars.partials;\n');
} else {
output.add('return templates;\n');
}
}
output.add('});');
} else if (!opts.commonjs) {
output.add('})();');
}
}
output = output.toStringWithSourceMap();
output.map = output.map + '';
if (opts.min) {
output = _uglify.minify(output.code, {
fromString: true,
outSourceMap: opts.map,
inSourceMap: JSON.parse(output.map)
});
if (opts.map) {
output.add('\n//# sourceMappingURL=' + opts.map + '\n');
output.code += '\n//# sourceMappingURL=' + opts.map + '\n';
}
}
output = output.toStringWithSourceMap();
output.map = output.map + '';
if (opts.map) {
_fs2.writeFileSync(opts.map, output.map, 'utf8');
}
output = output.code;
if (opts.min) {
output = uglify.minify(output.code, {
fromString: true,
outSourceMap: opts.map,
inSourceMap: JSON.parse(output.map)
});
if (opts.map) {
output.code += '\n//# sourceMappingURL=' + opts.map + '\n';
}
}
if (opts.map) {
fs.writeFileSync(opts.map, output.map, 'utf8');
}
output = output.code;
if (opts.output) {
fs.writeFileSync(opts.output, output, 'utf8');
} else {
console.log(output);
}
};
});
if (opts.output) {
_fs2.writeFileSync(opts.output, output, 'utf8');
} else {
console.log(output);
}
};
});

@@ -1,50 +0,67 @@

"use strict";
/*globals Handlebars: true */
var Handlebars = require("./handlebars.runtime")["default"];
'use strict';
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };
exports.__esModule = true;
var _Handlebars = require('./handlebars.runtime');
var _Handlebars2 = _interopRequireWildcard(_Handlebars);
// Compiler imports
var AST = require("./handlebars/compiler/ast")["default"];
var Parser = require("./handlebars/compiler/base").parser;
var parse = require("./handlebars/compiler/base").parse;
var Compiler = require("./handlebars/compiler/compiler").Compiler;
var compile = require("./handlebars/compiler/compiler").compile;
var precompile = require("./handlebars/compiler/compiler").precompile;
var JavaScriptCompiler = require("./handlebars/compiler/javascript-compiler")["default"];
var _create = Handlebars.create;
var create = function() {
var _AST = require('./handlebars/compiler/ast');
var _AST2 = _interopRequireWildcard(_AST);
var _Parser$parse = require('./handlebars/compiler/base');
var _Compiler$compile$precompile = require('./handlebars/compiler/compiler');
var _JavaScriptCompiler = require('./handlebars/compiler/javascript-compiler');
var _JavaScriptCompiler2 = _interopRequireWildcard(_JavaScriptCompiler);
var _Visitor = require('./handlebars/compiler/visitor');
var _Visitor2 = _interopRequireWildcard(_Visitor);
var _create = _Handlebars2['default'].create;
function create() {
var hb = _create();
hb.compile = function(input, options) {
return compile(input, options, hb);
hb.compile = function (input, options) {
return _Compiler$compile$precompile.compile(input, options, hb);
};
hb.precompile = function (input, options) {
return precompile(input, options, hb);
return _Compiler$compile$precompile.precompile(input, options, hb);
};
hb.AST = AST;
hb.Compiler = Compiler;
hb.JavaScriptCompiler = JavaScriptCompiler;
hb.Parser = Parser;
hb.parse = parse;
hb.AST = _AST2['default'];
hb.Compiler = _Compiler$compile$precompile.Compiler;
hb.JavaScriptCompiler = _JavaScriptCompiler2['default'];
hb.Parser = _Parser$parse.parser;
hb.parse = _Parser$parse.parse;
return hb;
};
}
Handlebars = create();
Handlebars.create = create;
var inst = create();
inst.create = create;
inst.Visitor = _Visitor2['default'];
/*jshint -W040 */
/* istanbul ignore next */
var root = typeof global !== 'undefined' ? global : window,
$Handlebars = root.Handlebars;
var $Handlebars = global.Handlebars;
/* istanbul ignore next */
Handlebars.noConflict = function() {
if (root.Handlebars === Handlebars) {
root.Handlebars = $Handlebars;
inst.noConflict = function () {
if (global.Handlebars === inst) {
global.Handlebars = $Handlebars;
}
};
Handlebars['default'] = Handlebars;
inst['default'] = inst;
exports["default"] = Handlebars;
exports['default'] = inst;
module.exports = exports['default'];

@@ -1,19 +0,38 @@

"use strict";
/*globals Handlebars: true */
var base = require("./handlebars/base");
'use strict';
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };
exports.__esModule = true;
/*global window */
var _import = require('./handlebars/base');
var base = _interopRequireWildcard(_import);
// Each of these augment the Handlebars object. No need to setup here.
// (This is done to easily share code between commonjs and browse envs)
var SafeString = require("./handlebars/safe-string")["default"];
var Exception = require("./handlebars/exception")["default"];
var Utils = require("./handlebars/utils");
var runtime = require("./handlebars/runtime");
var _SafeString = require('./handlebars/safe-string');
var _SafeString2 = _interopRequireWildcard(_SafeString);
var _Exception = require('./handlebars/exception');
var _Exception2 = _interopRequireWildcard(_Exception);
var _import2 = require('./handlebars/utils');
var Utils = _interopRequireWildcard(_import2);
var _import3 = require('./handlebars/runtime');
var runtime = _interopRequireWildcard(_import3);
// For compatibility and usage outside of module systems, make the Handlebars object a namespace
var create = function() {
function create() {
var hb = new base.HandlebarsEnvironment();
Utils.extend(hb, base);
hb.SafeString = SafeString;
hb.Exception = Exception;
hb.SafeString = _SafeString2['default'];
hb.Exception = _Exception2['default'];
hb.Utils = Utils;

@@ -23,3 +42,3 @@ hb.escapeExpression = Utils.escapeExpression;

hb.VM = runtime;
hb.template = function(spec) {
hb.template = function (spec) {
return runtime.template(spec, hb);

@@ -29,3 +48,3 @@ };

return hb;
};
}

@@ -40,3 +59,3 @@ var Handlebars = create();

/* istanbul ignore next */
Handlebars.noConflict = function() {
Handlebars.noConflict = function () {
if (root.Handlebars === Handlebars) {

@@ -49,2 +68,3 @@ root.Handlebars = $Handlebars;

exports["default"] = Handlebars;
exports['default'] = Handlebars;
module.exports = exports['default'];

@@ -1,7 +0,21 @@

"use strict";
var Utils = require("./utils");
var Exception = require("./exception")["default"];
'use strict';
var VERSION = "3.0.1";
exports.VERSION = VERSION;var COMPILER_REVISION = 6;
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };
exports.__esModule = true;
exports.HandlebarsEnvironment = HandlebarsEnvironment;
exports.createFrame = createFrame;
var _import = require('./utils');
var Utils = _interopRequireWildcard(_import);
var _Exception = require('./exception');
var _Exception2 = _interopRequireWildcard(_Exception);
var VERSION = '3.0.1';
exports.VERSION = VERSION;
var COMPILER_REVISION = 6;
exports.COMPILER_REVISION = COMPILER_REVISION;

@@ -16,2 +30,3 @@ var REVISION_CHANGES = {

};
exports.REVISION_CHANGES = REVISION_CHANGES;

@@ -30,3 +45,3 @@ var isArray = Utils.isArray,

exports.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = {
HandlebarsEnvironment.prototype = {
constructor: HandlebarsEnvironment,

@@ -37,5 +52,7 @@

registerHelper: function(name, fn) {
registerHelper: function registerHelper(name, fn) {
if (toString.call(name) === objectType) {
if (fn) { throw new Exception('Arg not supported with multiple helpers'); }
if (fn) {
throw new _Exception2['default']('Arg not supported with multiple helpers');
}
Utils.extend(this.helpers, name);

@@ -46,12 +63,12 @@ } else {

},
unregisterHelper: function(name) {
unregisterHelper: function unregisterHelper(name) {
delete this.helpers[name];
},
registerPartial: function(name, partial) {
registerPartial: function registerPartial(name, partial) {
if (toString.call(name) === objectType) {
Utils.extend(this.partials, name);
Utils.extend(this.partials, name);
} else {
if (typeof partial === 'undefined') {
throw new Exception('Attempting to register a partial as undefined');
throw new _Exception2['default']('Attempting to register a partial as undefined');
}

@@ -61,3 +78,3 @@ this.partials[name] = partial;

},
unregisterPartial: function(name) {
unregisterPartial: function unregisterPartial(name) {
delete this.partials[name];

@@ -68,4 +85,4 @@ }

function registerDefaultHelpers(instance) {
instance.registerHelper('helperMissing', function(/* [args, ]options */) {
if(arguments.length === 1) {
instance.registerHelper('helperMissing', function () {
if (arguments.length === 1) {
// A missing field in a {{foo}} constuct.

@@ -75,16 +92,16 @@ return undefined;

// Someone is actually trying to call something, blow up.
throw new Exception("Missing helper: '" + arguments[arguments.length-1].name + "'");
throw new _Exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"');
}
});
instance.registerHelper('blockHelperMissing', function(context, options) {
instance.registerHelper('blockHelperMissing', function (context, options) {
var inverse = options.inverse,
fn = options.fn;
if(context === true) {
if (context === true) {
return fn(this);
} else if(context === false || context == null) {
} else if (context === false || context == null) {
return inverse(this);
} else if (isArray(context)) {
if(context.length > 0) {
if (context.length > 0) {
if (options.ids) {

@@ -102,3 +119,3 @@ options.ids = [options.name];

data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name);
options = {data: data};
options = { data: data };
}

@@ -110,11 +127,14 @@

instance.registerHelper('each', function(context, options) {
instance.registerHelper('each', function (context, options) {
if (!options) {
throw new Exception('Must pass iterator to #each');
throw new _Exception2['default']('Must pass iterator to #each');
}
var fn = options.fn, inverse = options.inverse;
var i = 0, ret = "", data;
var fn = options.fn,
inverse = options.inverse,
i = 0,
ret = '',
data = undefined,
contextPath = undefined;
var contextPath;
if (options.data && options.ids) {

@@ -124,3 +144,5 @@ contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';

if (isFunction(context)) { context = context.call(this); }
if (isFunction(context)) {
context = context.call(this);
}

@@ -131,35 +153,35 @@ if (options.data) {

function execIteration(key, i, last) {
function execIteration(field, index, last) {
if (data) {
data.key = key;
data.index = i;
data.first = i === 0;
data.last = !!last;
data.key = field;
data.index = index;
data.first = index === 0;
data.last = !!last;
if (contextPath) {
data.contextPath = contextPath + key;
data.contextPath = contextPath + field;
}
}
ret = ret + fn(context[key], {
ret = ret + fn(context[field], {
data: data,
blockParams: Utils.blockParams([context[key], key], [contextPath + key, null])
blockParams: Utils.blockParams([context[field], field], [contextPath + field, null])
});
}
if(context && typeof context === 'object') {
if (context && typeof context === 'object') {
if (isArray(context)) {
for(var j = context.length; i<j; i++) {
execIteration(i, i, i === context.length-1);
for (var j = context.length; i < j; i++) {
execIteration(i, i, i === context.length - 1);
}
} else {
var priorKey;
var priorKey = undefined;
for(var key in context) {
if(context.hasOwnProperty(key)) {
for (var key in context) {
if (context.hasOwnProperty(key)) {
// We're running the iterations one step out of sync so we can detect
// the last iteration without have to scan the object twice and create
// an itermediate keys array.
// an itermediate keys array.
if (priorKey) {
execIteration(priorKey, i-1);
execIteration(priorKey, i - 1);
}

@@ -171,3 +193,3 @@ priorKey = key;

if (priorKey) {
execIteration(priorKey, i-1, true);
execIteration(priorKey, i - 1, true);
}

@@ -177,3 +199,3 @@ }

if(i === 0){
if (i === 0) {
ret = inverse(this);

@@ -185,4 +207,6 @@ }

instance.registerHelper('if', function(conditional, options) {
if (isFunction(conditional)) { conditional = conditional.call(this); }
instance.registerHelper('if', function (conditional, options) {
if (isFunction(conditional)) {
conditional = conditional.call(this);
}

@@ -192,3 +216,3 @@ // Default behavior is to render the positive path if the value is truthy and not empty.

// behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
if ((!options.hash.includeZero && !conditional) || Utils.isEmpty(conditional)) {
if (!options.hash.includeZero && !conditional || Utils.isEmpty(conditional)) {
return options.inverse(this);

@@ -200,8 +224,10 @@ } else {

instance.registerHelper('unless', function(conditional, options) {
return instance.helpers['if'].call(this, conditional, {fn: options.inverse, inverse: options.fn, hash: options.hash});
instance.registerHelper('unless', function (conditional, options) {
return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash });
});
instance.registerHelper('with', function(context, options) {
if (isFunction(context)) { context = context.call(this); }
instance.registerHelper('with', function (context, options) {
if (isFunction(context)) {
context = context.call(this);
}

@@ -214,3 +240,3 @@ var fn = options.fn;

data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]);
options = {data:data};
options = { data: data };
}

@@ -224,3 +250,3 @@

instance.registerHelper('log', function(message, options) {
instance.registerHelper('log', function (message, options) {
var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;

@@ -230,3 +256,3 @@ instance.log(level, message);

instance.registerHelper('lookup', function(obj, field) {
instance.registerHelper('lookup', function (obj, field) {
return obj && obj[field];

@@ -247,17 +273,21 @@ });

// Can be overridden in the host environment
log: function(level, message) {
log: function log(level, message) {
if (typeof console !== 'undefined' && logger.level <= level) {
var method = logger.methodMap[level];
(console[method] || console.log).call(console, message);
(console[method] || console.log).call(console, message); // eslint-disable-line no-console
}
}
};
exports.logger = logger;
var log = logger.log;
exports.log = log;
var createFrame = function(object) {
function createFrame(object) {
var frame = Utils.extend({}, object);
frame._parent = object;
return frame;
};
exports.createFrame = createFrame;
}
/* [args, ]options */

@@ -1,4 +0,6 @@

"use strict";
'use strict';
exports.__esModule = true;
var AST = {
Program: function(statements, blockParams, strip, locInfo) {
Program: function Program(statements, blockParams, strip, locInfo) {
this.loc = locInfo;

@@ -12,3 +14,3 @@ this.type = 'Program';

MustacheStatement: function(path, params, hash, escaped, strip, locInfo) {
MustacheStatement: function MustacheStatement(path, params, hash, escaped, strip, locInfo) {
this.loc = locInfo;

@@ -25,3 +27,3 @@ this.type = 'MustacheStatement';

BlockStatement: function(path, params, hash, program, inverse, openStrip, inverseStrip, closeStrip, locInfo) {
BlockStatement: function BlockStatement(path, params, hash, program, inverse, openStrip, inverseStrip, closeStrip, locInfo) {
this.loc = locInfo;

@@ -33,4 +35,4 @@ this.type = 'BlockStatement';

this.hash = hash;
this.program = program;
this.inverse = inverse;
this.program = program;
this.inverse = inverse;

@@ -42,3 +44,3 @@ this.openStrip = openStrip;

PartialStatement: function(name, params, hash, strip, locInfo) {
PartialStatement: function PartialStatement(name, params, hash, strip, locInfo) {
this.loc = locInfo;

@@ -55,3 +57,3 @@ this.type = 'PartialStatement';

ContentStatement: function(string, locInfo) {
ContentStatement: function ContentStatement(string, locInfo) {
this.loc = locInfo;

@@ -62,3 +64,3 @@ this.type = 'ContentStatement';

CommentStatement: function(comment, strip, locInfo) {
CommentStatement: function CommentStatement(comment, strip, locInfo) {
this.loc = locInfo;

@@ -71,3 +73,3 @@ this.type = 'CommentStatement';

SubExpression: function(path, params, hash, locInfo) {
SubExpression: function SubExpression(path, params, hash, locInfo) {
this.loc = locInfo;

@@ -81,3 +83,3 @@

PathExpression: function(data, depth, parts, original, locInfo) {
PathExpression: function PathExpression(data, depth, parts, original, locInfo) {
this.loc = locInfo;

@@ -88,33 +90,42 @@ this.type = 'PathExpression';

this.original = original;
this.parts = parts;
this.depth = depth;
this.parts = parts;
this.depth = depth;
},
StringLiteral: function(string, locInfo) {
StringLiteral: function StringLiteral(string, locInfo) {
this.loc = locInfo;
this.type = 'StringLiteral';
this.original =
this.value = string;
this.original = this.value = string;
},
NumberLiteral: function(number, locInfo) {
NumberLiteral: function NumberLiteral(number, locInfo) {
this.loc = locInfo;
this.type = 'NumberLiteral';
this.original =
this.value = Number(number);
this.original = this.value = Number(number);
},
BooleanLiteral: function(bool, locInfo) {
BooleanLiteral: function BooleanLiteral(bool, locInfo) {
this.loc = locInfo;
this.type = 'BooleanLiteral';
this.original =
this.value = bool === 'true';
this.original = this.value = bool === 'true';
},
Hash: function(pairs, locInfo) {
UndefinedLiteral: function UndefinedLiteral(locInfo) {
this.loc = locInfo;
this.type = 'UndefinedLiteral';
this.original = this.value = undefined;
},
NullLiteral: function NullLiteral(locInfo) {
this.loc = locInfo;
this.type = 'NullLiteral';
this.original = this.value = null;
},
Hash: function Hash(pairs, locInfo) {
this.loc = locInfo;
this.type = 'Hash';
this.pairs = pairs;
},
HashPair: function(key, value, locInfo) {
HashPair: function HashPair(key, value, locInfo) {
this.loc = locInfo;

@@ -131,9 +142,8 @@ this.type = 'HashPair';

// * it has at least one parameter or hash segment
// TODO: Make these public utility methods
helperExpression: function(node) {
helperExpression: function helperExpression(node) {
return !!(node.type === 'SubExpression' || node.params.length || node.hash);
},
scopedId: function(path) {
return (/^\.|this\b/).test(path.original);
scopedId: function scopedId(path) {
return /^\.|this\b/.test(path.original);
},

@@ -143,3 +153,3 @@

// `..` or `this`.
simpleId: function(path) {
simpleId: function simpleId(path) {
return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth;

@@ -150,5 +160,5 @@ }

// Must be exported as an object rather than the root of the module as the jison lexer
// must modify the object to operate properly.
exports["default"] = AST;
exports['default'] = AST;
module.exports = exports['default'];

@@ -1,28 +0,46 @@

"use strict";
var parser = require("./parser")["default"];
var AST = require("./ast")["default"];
var WhitespaceControl = require("./whitespace-control")["default"];
var Helpers = require("./helpers");
var extend = require("../utils").extend;
'use strict';
exports.parser = parser;
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };
exports.__esModule = true;
exports.parse = parse;
var _parser = require('./parser');
var _parser2 = _interopRequireWildcard(_parser);
var _AST = require('./ast');
var _AST2 = _interopRequireWildcard(_AST);
var _WhitespaceControl = require('./whitespace-control');
var _WhitespaceControl2 = _interopRequireWildcard(_WhitespaceControl);
var _import = require('./helpers');
var Helpers = _interopRequireWildcard(_import);
var _extend = require('../utils');
exports.parser = _parser2['default'];
var yy = {};
extend(yy, Helpers, AST);
_extend.extend(yy, Helpers, _AST2['default']);
function parse(input, options) {
// Just return if an already-compiled AST was passed in.
if (input.type === 'Program') { return input; }
if (input.type === 'Program') {
return input;
}
parser.yy = yy;
_parser2['default'].yy = yy;
// Altering the shared object here, but this is ok as parser is a sync operation
yy.locInfo = function(locInfo) {
yy.locInfo = function (locInfo) {
return new yy.SourceLocation(options && options.srcName, locInfo);
};
var strip = new WhitespaceControl();
return strip.accept(parser.parse(input));
}
exports.parse = parse;
var strip = new _WhitespaceControl2['default']();
return strip.accept(_parser2['default'].parse(input));
}

@@ -1,10 +0,23 @@

"use strict";
var isArray = require("../utils").isArray;
'use strict';
exports.__esModule = true;
/*global define */
var _isArray = require('../utils');
var SourceNode = undefined;
try {
var SourceMap = require('source-map'),
SourceNode = SourceMap.SourceNode;
} catch (err) {
/* istanbul ignore next: tested but not covered in istanbul due to dist build */
SourceNode = function(line, column, srcFile, chunks) {
/* istanbul ignore next */
if (typeof define !== 'function' || !define.amd) {
// We don't support this in AMD environments. For these environments, we asusme that
// they are running on the browser and thus have no need for the source-map library.
var SourceMap = require('source-map');
SourceNode = SourceMap.SourceNode;
}
} catch (err) {}
/* istanbul ignore if: tested but not covered in istanbul due to dist build */
if (!SourceNode) {
SourceNode = function (line, column, srcFile, chunks) {
this.src = '';

@@ -17,4 +30,4 @@ if (chunks) {

SourceNode.prototype = {
add: function(chunks) {
if (isArray(chunks)) {
add: function add(chunks) {
if (_isArray.isArray(chunks)) {
chunks = chunks.join('');

@@ -24,4 +37,4 @@ }

},
prepend: function(chunks) {
if (isArray(chunks)) {
prepend: function prepend(chunks) {
if (_isArray.isArray(chunks)) {
chunks = chunks.join('');

@@ -31,6 +44,6 @@ }

},
toStringWithSourceMap: function() {
return {code: this.toString()};
toStringWithSourceMap: function toStringWithSourceMap() {
return { code: this.toString() };
},
toString: function() {
toString: function toString() {
return this.src;

@@ -41,5 +54,4 @@ }

function castChunk(chunk, codeGen, loc) {
if (isArray(chunk)) {
if (_isArray.isArray(chunk)) {
var ret = [];

@@ -53,3 +65,3 @@

// Handle primitives that the SourceNode will throw up on
return chunk+'';
return chunk + '';
}

@@ -59,3 +71,2 @@ return chunk;

function CodeGen(srcFile) {

@@ -67,12 +78,12 @@ this.srcFile = srcFile;

CodeGen.prototype = {
prepend: function(source, loc) {
prepend: function prepend(source, loc) {
this.source.unshift(this.wrap(source, loc));
},
push: function(source, loc) {
push: function push(source, loc) {
this.source.push(this.wrap(source, loc));
},
merge: function() {
merge: function merge() {
var source = this.empty();
this.each(function(line) {
this.each(function (line) {
source.add([' ', line, '\n']);

@@ -83,3 +94,3 @@ });

each: function(iter) {
each: function each(iter) {
for (var i = 0, len = this.source.length; i < len; i++) {

@@ -90,7 +101,10 @@ iter(this.source[i]);

empty: function(loc) {
loc = loc || this.currentLocation || {start:{}};
empty: function empty() {
var loc = arguments[0] === undefined ? this.currentLocation || { start: {} } : arguments[0];
return new SourceNode(loc.start.line, loc.start.column, this.srcFile);
},
wrap: function(chunk, loc) {
wrap: function wrap(chunk) {
var loc = arguments[1] === undefined ? this.currentLocation || { start: {} } : arguments[1];
if (chunk instanceof SourceNode) {

@@ -100,3 +114,2 @@ return chunk;

loc = loc || this.currentLocation || {start:{}};
chunk = castChunk(chunk, this, loc);

@@ -107,3 +120,3 @@

functionCall: function(fn, type, params) {
functionCall: function functionCall(fn, type, params) {
params = this.generateList(params);

@@ -113,13 +126,8 @@ return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']);

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') + '"';
quotedString: function quotedString(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') + '"';
},
objectLiteral: function(obj) {
objectLiteral: function objectLiteral(obj) {
var pairs = [];

@@ -142,4 +150,3 @@

generateList: function(entries, loc) {
generateList: function generateList(entries, loc) {
var ret = this.empty(loc);

@@ -158,3 +165,3 @@

generateArray: function(entries, loc) {
generateArray: function generateArray(entries, loc) {
var ret = this.generateList(entries, loc);

@@ -168,2 +175,5 @@ ret.prepend('[');

exports["default"] = CodeGen;
exports['default'] = CodeGen;
module.exports = exports['default'];
/* NOP */

@@ -1,13 +0,25 @@

"use strict";
var Exception = require("../exception")["default"];
var isArray = require("../utils").isArray;
var indexOf = require("../utils").indexOf;
var AST = require("./ast")["default"];
'use strict';
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };
exports.__esModule = true;
exports.Compiler = Compiler;
exports.precompile = precompile;
exports.compile = compile;
var _Exception = require('../exception');
var _Exception2 = _interopRequireWildcard(_Exception);
var _isArray$indexOf = require('../utils');
var _AST = require('./ast');
var _AST2 = _interopRequireWildcard(_AST);
var slice = [].slice;
function Compiler() {}
exports.Compiler = Compiler;// the foundHelper register will disambiguate helper lookup from finding a
// the foundHelper register will disambiguate helper lookup from finding a
// function in a context. This is necessary for mustache compatibility, which

@@ -20,3 +32,3 @@ // requires that context functions in blocks are evaluated by blockHelperMissing,

equals: function(other) {
equals: function equals(other) {
var len = this.opcodes.length;

@@ -38,3 +50,3 @@ if (other.opcodes.length !== len) {

len = this.children.length;
for (i = 0; i < len; i++) {
for (var i = 0; i < len; i++) {
if (!this.children[i].equals(other.children[i])) {

@@ -50,3 +62,3 @@ return false;

compile: function(program, options) {
compile: function compile(program, options) {
this.sourceNode = [];

@@ -64,14 +76,16 @@ this.opcodes = [];

options.knownHelpers = {
'helperMissing': true,
'blockHelperMissing': true,
'each': true,
helperMissing: true,
blockHelperMissing: true,
each: true,
'if': true,
'unless': true,
unless: true,
'with': true,
'log': true,
'lookup': true
log: true,
lookup: true
};
if (knownHelpers) {
for (var name in knownHelpers) {
options.knownHelpers[name] = knownHelpers[name];
for (var _name in knownHelpers) {
if (_name in knownHelpers) {
options.knownHelpers[_name] = knownHelpers[_name];
}
}

@@ -83,5 +97,7 @@ }

compileProgram: function(program) {
var result = new this.compiler().compile(program, this.options);
var guid = this.guid++;
compileProgram: function compileProgram(program) {
var childCompiler = new this.compiler(),
// eslint-disable-line new-cap
result = childCompiler.compile(program, this.options),
guid = this.guid++;

@@ -96,3 +112,3 @@ this.usePartial = this.usePartial || result.usePartial;

accept: function(node) {
accept: function accept(node) {
this.sourceNode.unshift(node);

@@ -104,7 +120,8 @@ var ret = this[node.type](node);

Program: function(program) {
Program: function Program(program) {
this.options.blockParams.unshift(program.blockParams);
var body = program.body;
for(var i=0, l=body.length; i<l; i++) {
var body = program.body,
bodyLength = body.length;
for (var i = 0; i < bodyLength; i++) {
this.accept(body[i]);

@@ -115,3 +132,3 @@ }

this.isSimple = l === 1;
this.isSimple = bodyLength === 1;
this.blockParams = program.blockParams ? program.blockParams.length : 0;

@@ -122,3 +139,3 @@

BlockStatement: function(block) {
BlockStatement: function BlockStatement(block) {
transformLiteralToPath(block);

@@ -159,3 +176,3 @@

PartialStatement: function(partial) {
PartialStatement: function PartialStatement(partial) {
this.usePartial = true;

@@ -165,5 +182,5 @@

if (params.length > 1) {
throw new Exception('Unsupported number of partial arguments: ' + params.length, partial);
throw new _Exception2['default']('Unsupported number of partial arguments: ' + params.length, partial);
} else if (!params.length) {
params.push({type: 'PathExpression', parts: [], depth: 0});
params.push({ type: 'PathExpression', parts: [], depth: 0 });
}

@@ -189,6 +206,6 @@

MustacheStatement: function(mustache) {
this.SubExpression(mustache);
MustacheStatement: function MustacheStatement(mustache) {
this.SubExpression(mustache); // eslint-disable-line new-cap
if(mustache.escaped && !this.options.noEscape) {
if (mustache.escaped && !this.options.noEscape) {
this.opcode('appendEscaped');

@@ -200,3 +217,3 @@ } else {

ContentStatement: function(content) {
ContentStatement: function ContentStatement(content) {
if (content.value) {

@@ -207,5 +224,5 @@ this.opcode('appendContent', content.value);

CommentStatement: function() {},
CommentStatement: function CommentStatement() {},
SubExpression: function(sexpr) {
SubExpression: function SubExpression(sexpr) {
transformLiteralToPath(sexpr);

@@ -222,3 +239,3 @@ var type = this.classifySexpr(sexpr);

},
ambiguousSexpr: function(sexpr, program, inverse) {
ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) {
var path = sexpr.path,

@@ -238,3 +255,3 @@ name = path.parts[0],

simpleSexpr: function(sexpr) {
simpleSexpr: function simpleSexpr(sexpr) {
this.accept(sexpr.path);

@@ -244,3 +261,3 @@ this.opcode('resolvePossibleLambda');

helperSexpr: function(sexpr, program, inverse) {
helperSexpr: function helperSexpr(sexpr, program, inverse) {
var params = this.setupFullMustacheParams(sexpr, program, inverse),

@@ -253,3 +270,3 @@ path = sexpr.path,

} else if (this.options.knownHelpersOnly) {
throw new Exception("You specified knownHelpersOnly, but used the unknown helper " + name, sexpr);
throw new _Exception2['default']('You specified knownHelpersOnly, but used the unknown helper ' + name, sexpr);
} else {

@@ -259,7 +276,7 @@ path.falsy = true;

this.accept(path);
this.opcode('invokeHelper', params.length, path.original, AST.helpers.simpleId(path));
this.opcode('invokeHelper', params.length, path.original, _AST2['default'].helpers.simpleId(path));
}
},
PathExpression: function(path) {
PathExpression: function PathExpression(path) {
this.addDepth(path.depth);

@@ -269,3 +286,3 @@ this.opcode('getContext', path.depth);

var name = path.parts[0],
scoped = AST.helpers.scopedId(path),
scoped = _AST2['default'].helpers.scopedId(path),
blockParamId = !path.depth && !scoped && this.blockParamIndex(name);

@@ -275,3 +292,3 @@

this.opcode('lookupBlockParam', blockParamId, path.parts);
} else if (!name) {
} else if (!name) {
// Context reference, i.e. `{{foo .}}` or `{{foo ..}}`

@@ -287,20 +304,30 @@ this.opcode('pushContext');

StringLiteral: function(string) {
StringLiteral: function StringLiteral(string) {
this.opcode('pushString', string.value);
},
NumberLiteral: function(number) {
NumberLiteral: function NumberLiteral(number) {
this.opcode('pushLiteral', number.value);
},
BooleanLiteral: function(bool) {
BooleanLiteral: function BooleanLiteral(bool) {
this.opcode('pushLiteral', bool.value);
},
Hash: function(hash) {
var pairs = hash.pairs, i, l;
UndefinedLiteral: function UndefinedLiteral() {
this.opcode('pushLiteral', 'undefined');
},
NullLiteral: function NullLiteral() {
this.opcode('pushLiteral', 'null');
},
Hash: function Hash(hash) {
var pairs = hash.pairs,
i = 0,
l = pairs.length;
this.opcode('pushHash');
for (i=0, l=pairs.length; i<l; i++) {
for (; i < l; i++) {
this.pushParam(pairs[i].value);

@@ -315,7 +342,7 @@ }

// HELPERS
opcode: function(name) {
opcode: function opcode(name) {
this.opcodes.push({ opcode: name, args: slice.call(arguments, 1), loc: this.sourceNode[0].loc });
},
addDepth: function(depth) {
addDepth: function addDepth(depth) {
if (!depth) {

@@ -328,4 +355,4 @@ return;

classifySexpr: function(sexpr) {
var isSimple = AST.helpers.simpleId(sexpr.path);
classifySexpr: function classifySexpr(sexpr) {
var isSimple = _AST2['default'].helpers.simpleId(sexpr.path);

@@ -336,3 +363,3 @@ var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]);

// * its id is simple (a single part, not `this` or `..`)
var isHelper = !isBlockParam && AST.helpers.helperExpression(sexpr);
var isHelper = !isBlockParam && _AST2['default'].helpers.helperExpression(sexpr);

@@ -344,10 +371,9 @@ // if a mustache is an eligible helper but not a definite

var options = this.options;
// if ambiguous, we can possibly resolve the ambiguity now
// An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc.
if (isEligible && !isHelper) {
var name = sexpr.path.parts[0];
var _name2 = sexpr.path.parts[0],
options = this.options;
if (options.knownHelpers[name]) {
if (options.knownHelpers[_name2]) {
isHelper = true;

@@ -359,9 +385,13 @@ } else if (options.knownHelpersOnly) {

if (isHelper) { return 'helper'; }
else if (isEligible) { return 'ambiguous'; }
else { return 'simple'; }
if (isHelper) {
return 'helper';
} else if (isEligible) {
return 'ambiguous';
} else {
return 'simple';
}
},
pushParams: function(params) {
for(var i=0, l=params.length; i<l; i++) {
pushParams: function pushParams(params) {
for (var i = 0, l = params.length; i < l; i++) {
this.pushParam(params[i]);

@@ -371,3 +401,3 @@ }

pushParam: function(val) {
pushParam: function pushParam(val) {
var value = val.value != null ? val.value : val.original || '';

@@ -377,8 +407,6 @@

if (value.replace) {
value = value
.replace(/^(\.?\.\/)*/g, '')
.replace(/\//g, '.');
value = value.replace(/^(\.?\.\/)*/g, '').replace(/\//g, '.');
}
if(val.depth) {
if (val.depth) {
this.addDepth(val.depth);

@@ -396,5 +424,5 @@ }

if (this.trackIds) {
var blockParamIndex;
if (val.parts && !AST.helpers.scopedId(val) && !val.depth) {
blockParamIndex = this.blockParamIndex(val.parts[0]);
var blockParamIndex = undefined;
if (val.parts && !_AST2['default'].helpers.scopedId(val) && !val.depth) {
blockParamIndex = this.blockParamIndex(val.parts[0]);
}

@@ -407,5 +435,3 @@ if (blockParamIndex) {

if (value.replace) {
value = value
.replace(/^\.\//g, '')
.replace(/^\.$/g, '');
value = value.replace(/^\.\//g, '').replace(/^\.$/g, '');
}

@@ -420,3 +446,3 @@

setupFullMustacheParams: function(sexpr, program, inverse, omitEmpty) {
setupFullMustacheParams: function setupFullMustacheParams(sexpr, program, inverse, omitEmpty) {
var params = sexpr.params;

@@ -437,6 +463,6 @@ this.pushParams(params);

blockParamIndex: function(name) {
blockParamIndex: function blockParamIndex(name) {
for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) {
var blockParams = this.options.blockParams[depth],
param = blockParams && indexOf(blockParams, name);
param = blockParams && _isArray$indexOf.indexOf(blockParams, name);
if (blockParams && param >= 0) {

@@ -450,4 +476,4 @@ return [depth, param];

function precompile(input, options, env) {
if (input == null || (typeof input !== 'string' && input.type !== 'Program')) {
throw new Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed " + input);
if (input == null || typeof input !== 'string' && input.type !== 'Program') {
throw new _Exception2['default']('You must pass a string or Handlebars AST to Handlebars.precompile. You passed ' + input);
}

@@ -463,14 +489,14 @@

var ast = env.parse(input, options);
var environment = new env.Compiler().compile(ast, options);
var ast = env.parse(input, options),
environment = new env.Compiler().compile(ast, options);
return new env.JavaScriptCompiler().compile(environment, options);
}
exports.precompile = precompile;function compile(input, options, env) {
if (input == null || (typeof input !== 'string' && input.type !== 'Program')) {
throw new Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input);
function compile(input, _x, env) {
var options = arguments[1] === undefined ? {} : arguments[1];
if (input == null || typeof input !== 'string' && input.type !== 'Program') {
throw new _Exception2['default']('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input);
}
options = options || {};
if (!('data' in options)) {

@@ -483,8 +509,8 @@ options.data = true;

var compiled;
var compiled = undefined;
function compileInput() {
var ast = env.parse(input, options);
var environment = new env.Compiler().compile(ast, options);
var templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true);
var ast = env.parse(input, options),
environment = new env.Compiler().compile(ast, options),
templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true);
return env.template(templateSpec);

@@ -494,15 +520,15 @@ }

// Template is only compiled on first use and cached after that point.
var ret = function(context, options) {
function ret(context, execOptions) {
if (!compiled) {
compiled = compileInput();
}
return compiled.call(this, context, options);
};
ret._setup = function(options) {
return compiled.call(this, context, execOptions);
}
ret._setup = function (setupOptions) {
if (!compiled) {
compiled = compileInput();
}
return compiled._setup(options);
return compiled._setup(setupOptions);
};
ret._child = function(i, data, blockParams, depths) {
ret._child = function (i, data, blockParams, depths) {
if (!compiled) {

@@ -516,3 +542,3 @@ compiled = compileInput();

exports.compile = compile;function argEquals(a, b) {
function argEquals(a, b) {
if (a === b) {

@@ -522,3 +548,3 @@ return true;

if (isArray(a) && isArray(b) && a.length === b.length) {
if (_isArray$indexOf.isArray(a) && _isArray$indexOf.isArray(b) && a.length === b.length) {
for (var i = 0; i < a.length; i++) {

@@ -538,4 +564,4 @@ if (!argEquals(a[i], b[i])) {

// of the system.
sexpr.path = new AST.PathExpression(false, 0, [literal.original+''], literal.original+'', literal.loc);
sexpr.path = new _AST2['default'].PathExpression(false, 0, [literal.original + ''], literal.original + '', literal.loc);
}
}

@@ -1,4 +0,19 @@

"use strict";
var Exception = require("../exception")["default"];
'use strict';
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };
exports.__esModule = true;
exports.SourceLocation = SourceLocation;
exports.id = id;
exports.stripFlags = stripFlags;
exports.stripComment = stripComment;
exports.preparePath = preparePath;
exports.prepareMustache = prepareMustache;
exports.prepareRawBlock = prepareRawBlock;
exports.prepareBlock = prepareBlock;
var _Exception = require('../exception');
var _Exception2 = _interopRequireWildcard(_Exception);
function SourceLocation(source, locInfo) {

@@ -16,15 +31,22 @@ this.source = source;

exports.SourceLocation = SourceLocation;function stripFlags(open, close) {
function id(token) {
if (/^\[.*\]$/.test(token)) {
return token.substr(1, token.length - 2);
} else {
return token;
}
}
function stripFlags(open, close) {
return {
open: open.charAt(2) === '~',
close: close.charAt(close.length-3) === '~'
close: close.charAt(close.length - 3) === '~'
};
}
exports.stripFlags = stripFlags;function stripComment(comment) {
return comment.replace(/^\{\{~?\!-?-?/, '')
.replace(/-?-?~?\}\}$/, '');
function stripComment(comment) {
return comment.replace(/^\{\{~?\!-?-?/, '').replace(/-?-?~?\}\}$/, '');
}
exports.stripComment = stripComment;function preparePath(data, parts, locInfo) {
function preparePath(data, parts, locInfo) {
/*jshint -W040 */

@@ -38,9 +60,13 @@ locInfo = this.locInfo(locInfo);

for(var i=0,l=parts.length; i<l; i++) {
var part = parts[i].part;
for (var i = 0, l = parts.length; i < l; i++) {
var part = parts[i].part,
// If we have [] syntax then we do not treat path references as operators,
// i.e. foo.[this] resolves to approximately context.foo['this']
isLiteral = parts[i].original !== part;
original += (parts[i].separator || '') + part;
if (part === '..' || part === '.' || part === 'this') {
if (!isLiteral && (part === '..' || part === '.' || part === 'this')) {
if (dig.length > 0) {
throw new Exception('Invalid path: ' + original, {loc: locInfo});
throw new _Exception2['default']('Invalid path: ' + original, { loc: locInfo });
} else if (part === '..') {

@@ -58,3 +84,3 @@ depth++;

exports.preparePath = preparePath;function prepareMustache(path, params, hash, open, strip, locInfo) {
function prepareMustache(path, params, hash, open, strip, locInfo) {
/*jshint -W040 */

@@ -68,8 +94,8 @@ // Must use charAt to support IE pre-10

exports.prepareMustache = prepareMustache;function prepareRawBlock(openRawBlock, content, close, locInfo) {
function prepareRawBlock(openRawBlock, content, close, locInfo) {
/*jshint -W040 */
if (openRawBlock.path.original !== close) {
var errorNode = {loc: openRawBlock.path.loc};
var errorNode = { loc: openRawBlock.path.loc };
throw new Exception(openRawBlock.path.original + " doesn't match " + close, errorNode);
throw new _Exception2['default'](openRawBlock.path.original + ' doesn\'t match ' + close, errorNode);
}

@@ -80,16 +106,12 @@

return new this.BlockStatement(
openRawBlock.path, openRawBlock.params, openRawBlock.hash,
program, undefined,
{}, {}, {},
locInfo);
return new this.BlockStatement(openRawBlock.path, openRawBlock.params, openRawBlock.hash, program, undefined, {}, {}, {}, locInfo);
}
exports.prepareRawBlock = prepareRawBlock;function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) {
function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) {
/*jshint -W040 */
// When we are chaining inverse calls, we will not have a close path
if (close && close.path && openBlock.path.original !== close.path.original) {
var errorNode = {loc: openBlock.path.loc};
var errorNode = { loc: openBlock.path.loc };
throw new Exception(openBlock.path.original + ' doesn\'t match ' + close.path.original, errorNode);
throw new _Exception2['default'](openBlock.path.original + ' doesn\'t match ' + close.path.original, errorNode);
}

@@ -99,4 +121,4 @@

var inverse,
inverseStrip;
var inverse = undefined,
inverseStrip = undefined;

@@ -118,9 +140,3 @@ if (inverseAndProgram) {

return new this.BlockStatement(
openBlock.path, openBlock.params, openBlock.hash,
program, inverse,
openBlock.strip, inverseStrip, close && close.strip,
this.locInfo(locInfo));
}
exports.prepareBlock = prepareBlock;
return new this.BlockStatement(openBlock.path, openBlock.params, openBlock.hash, program, inverse, openBlock.strip, inverseStrip, close && close.strip, this.locInfo(locInfo));
}

@@ -1,8 +0,19 @@

"use strict";
var COMPILER_REVISION = require("../base").COMPILER_REVISION;
var REVISION_CHANGES = require("../base").REVISION_CHANGES;
var Exception = require("../exception")["default"];
var isArray = require("../utils").isArray;
var CodeGen = require("./code-gen")["default"];
'use strict';
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };
exports.__esModule = true;
var _COMPILER_REVISION$REVISION_CHANGES = require('../base');
var _Exception = require('../exception');
var _Exception2 = _interopRequireWildcard(_Exception);
var _isArray = require('../utils');
var _CodeGen = require('./code-gen');
var _CodeGen2 = _interopRequireWildcard(_CodeGen);
function Literal(value) {

@@ -17,22 +28,22 @@ this.value = value;

// alternative compiled forms for name lookup and buffering semantics
nameLookup: function(parent, name /* , type*/) {
nameLookup: function nameLookup(parent, name /* , type*/) {
if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
return [parent, ".", name];
return [parent, '.', name];
} else {
return [parent, "['", name, "']"];
return [parent, '[\'', name, '\']'];
}
},
depthedLookup: function(name) {
depthedLookup: function depthedLookup(name) {
return [this.aliasable('this.lookup'), '(depths, "', name, '")'];
},
compilerInfo: function() {
var revision = COMPILER_REVISION,
versions = REVISION_CHANGES[revision];
compilerInfo: function compilerInfo() {
var revision = _COMPILER_REVISION$REVISION_CHANGES.COMPILER_REVISION,
versions = _COMPILER_REVISION$REVISION_CHANGES.REVISION_CHANGES[revision];
return [revision, versions];
},
appendToBuffer: function(source, location, explicit) {
appendToBuffer: function appendToBuffer(source, location, explicit) {
// Force a source as this simplifies the merge logic.
if (!isArray(source)) {
if (!_isArray.isArray(source)) {
source = [source];

@@ -55,8 +66,8 @@ }

initializeBuffer: function() {
return this.quotedString("");
initializeBuffer: function initializeBuffer() {
return this.quotedString('');
},
// END PUBLIC API
compile: function(environment, options, context, asObject) {
compile: function compile(environment, options, context, asObject) {
this.environment = environment;

@@ -92,6 +103,6 @@ this.options = options;

var opcodes = environment.opcodes,
opcode,
firstLoc,
i,
l;
opcode = undefined,
firstLoc = undefined,
i = undefined,
l = undefined;

@@ -112,3 +123,3 @@ for (i = 0, l = opcodes.length; i < l; i++) {

if (this.stackSlot || this.inlineStack.length || this.compileStack.length) {
throw new Exception('Compile completed with content left on stack');
throw new _Exception2['default']('Compile completed with content left on stack');
}

@@ -148,7 +159,7 @@

this.source.currentLocation = {start: {line: 1, column: 0}};
this.source.currentLocation = { start: { line: 1, column: 0 } };
ret = this.objectLiteral(ret);
if (options.srcName) {
ret = ret.toStringWithSourceMap({file: options.destName});
ret = ret.toStringWithSourceMap({ file: options.destName });
ret.map = ret.map && ret.map.toString();

@@ -168,15 +179,15 @@ } else {

preamble: function() {
preamble: function preamble() {
// track the last context pushed into place to allow skipping the
// getContext opcode when it would be a noop
this.lastContext = 0;
this.source = new CodeGen(this.options.srcName);
this.source = new _CodeGen2['default'](this.options.srcName);
},
createFunctionContext: function(asObject) {
createFunctionContext: function createFunctionContext(asObject) {
var varDeclarations = '';
var locals = this.stackVars.concat(this.registers.list);
if(locals.length > 0) {
varDeclarations += ", " + locals.join(", ");
if (locals.length > 0) {
varDeclarations += ', ' + locals.join(', ');
}

@@ -192,6 +203,7 @@

for (var alias in this.aliases) {
// eslint-disable-line guard-for-in
var node = this.aliases[alias];
if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) {
varDeclarations += ', alias' + (++aliasCount) + '=' + alias;
varDeclarations += ', alias' + ++aliasCount + '=' + alias;
node.children[0] = 'alias' + aliasCount;

@@ -201,3 +213,3 @@ }

var params = ["depth0", "helpers", "partials", "data"];
var params = ['depth0', 'helpers', 'partials', 'data'];

@@ -222,11 +234,10 @@ if (this.useBlockParams || this.useDepths) {

},
mergeSource: function(varDeclarations) {
mergeSource: function mergeSource(varDeclarations) {
var isSimple = this.environment.isSimple,
appendOnly = !this.forceBuffer,
appendFirst,
sourceSeen,
bufferStart,
bufferEnd;
this.source.each(function(line) {
appendFirst = undefined,
sourceSeen = undefined,
bufferStart = undefined,
bufferEnd = undefined;
this.source.each(function (line) {
if (line.appendToBuffer) {

@@ -257,3 +268,2 @@ if (bufferStart) {

if (appendOnly) {

@@ -267,3 +277,3 @@ if (bufferStart) {

} else {
varDeclarations += ", buffer = " + (appendFirst ? '' : this.initializeBuffer());
varDeclarations += ', buffer = ' + (appendFirst ? '' : this.initializeBuffer());

@@ -294,3 +304,3 @@ if (bufferStart) {

// invoking blockHelperMissing.
blockValue: function(name) {
blockValue: function blockValue(name) {
var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'),

@@ -312,3 +322,3 @@ params = [this.contextName(0)];

// On stack, after, if lastHelper: value
ambiguousBlockValue: function() {
ambiguousBlockValue: function ambiguousBlockValue() {
// We're being a bit cheeky and reusing the options value from the prior exec

@@ -324,6 +334,3 @@ var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'),

this.pushSource([
'if (!', this.lastHelper, ') { ',
current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params),
'}']);
this.pushSource(['if (!', this.lastHelper, ') { ', current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), '}']);
},

@@ -337,3 +344,3 @@

// Appends the string value of `content` to the current buffer
appendContent: function(content) {
appendContent: function appendContent(content) {
if (this.pendingContent) {

@@ -357,5 +364,5 @@ content = this.pendingContent + content;

// Otherwise, the empty string is appended
append: function() {
append: function append() {
if (this.isInline()) {
this.replaceStack(function(current) {
this.replaceStack(function (current) {
return [' != null ? ', current, ' : ""'];

@@ -369,3 +376,3 @@ });

if (this.environment.isSimple) {
this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']);
this.pushSource(['else { ', this.appendToBuffer('\'\'', undefined, true), ' }']);
}

@@ -381,5 +388,4 @@ }

// Escape `value` and append it to the buffer
appendEscaped: function() {
this.pushSource(this.appendToBuffer(
[this.aliasable('this.escapeExpression'), '(', this.popStack(), ')']));
appendEscaped: function appendEscaped() {
this.pushSource(this.appendToBuffer([this.aliasable('this.escapeExpression'), '(', this.popStack(), ')']));
},

@@ -394,3 +400,3 @@

// Set the value of the `lastContext` compiler value to the depth
getContext: function(depth) {
getContext: function getContext(depth) {
this.lastContext = depth;

@@ -405,3 +411,3 @@ },

// Pushes the value of the current context onto the stack.
pushContext: function() {
pushContext: function pushContext() {
this.pushStackLiteral(this.contextName(this.lastContext));

@@ -417,3 +423,3 @@ },

// it onto the stack.
lookupOnContext: function(parts, falsy, scoped) {
lookupOnContext: function lookupOnContext(parts, falsy, scoped) {
var i = 0;

@@ -439,3 +445,3 @@

// it onto the stack.
lookupBlockParam: function(blockParamId, parts) {
lookupBlockParam: function lookupBlockParam(blockParamId, parts) {
this.useBlockParams = true;

@@ -453,3 +459,3 @@

// Push the data lookup operator
lookupData: function(depth, parts) {
lookupData: function lookupData(depth, parts) {
/*jshint -W083 */

@@ -465,3 +471,5 @@ if (!depth) {

resolvePath: function(type, parts, i, falsy) {
resolvePath: function resolvePath(type, parts, i, falsy) {
var _this = this;
/*jshint -W083 */

@@ -475,4 +483,5 @@ if (this.options.strict || this.options.assumeObjects) {

for (; i < len; i++) {
this.replaceStack(function(current) {
var lookup = this.nameLookup(current, parts[i], type);
/*eslint-disable no-loop-func */
this.replaceStack(function (current) {
var lookup = _this.nameLookup(current, parts[i], type);
// We want to ensure that zero and false are handled properly if the context (falsy flag)

@@ -487,2 +496,3 @@ // needs to have the special handling for these values.

});
/*eslint-enable no-loop-func */
}

@@ -498,3 +508,3 @@ },

// the return value of the lambda
resolvePossibleLambda: function() {
resolvePossibleLambda: function resolvePossibleLambda() {
this.push([this.aliasable('this.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']);

@@ -511,3 +521,3 @@ },

// depth rather than resolving it immediately.
pushStringParam: function(string, type) {
pushStringParam: function pushStringParam(string, type) {
this.pushContext();

@@ -527,3 +537,3 @@ this.pushString(type);

emptyHash: function(omitEmpty) {
emptyHash: function emptyHash(omitEmpty) {
if (this.trackIds) {

@@ -538,9 +548,9 @@ this.push('{}'); // hashIds

},
pushHash: function() {
pushHash: function pushHash() {
if (this.hash) {
this.hashes.push(this.hash);
}
this.hash = {values: [], types: [], contexts: [], ids: []};
this.hash = { values: [], types: [], contexts: [], ids: [] };
},
popHash: function() {
popHash: function popHash() {
var hash = this.hash;

@@ -566,3 +576,3 @@ this.hash = this.hashes.pop();

// Push a quoted version of `string` onto the stack
pushString: function(string) {
pushString: function pushString(string) {
this.pushStackLiteral(this.quotedString(string));

@@ -579,3 +589,3 @@ },

// it.
pushLiteral: function(value) {
pushLiteral: function pushLiteral(value) {
this.pushStackLiteral(value);

@@ -592,3 +602,3 @@ },

// expression.
pushProgram: function(guid) {
pushProgram: function pushProgram(guid) {
if (guid != null) {

@@ -610,6 +620,6 @@ this.pushStackLiteral(this.programExpression(guid));

// If the helper is not found, `helperMissing` is called.
invokeHelper: function(paramSize, name, isSimple) {
var nonHelper = this.popStack();
var helper = this.setupHelper(paramSize, name);
var simple = isSimple ? [helper.name, ' || '] : '';
invokeHelper: function invokeHelper(paramSize, name, isSimple) {
var nonHelper = this.popStack(),
helper = this.setupHelper(paramSize, name),
simple = isSimple ? [helper.name, ' || '] : '';

@@ -632,3 +642,3 @@ var lookup = ['('].concat(simple, nonHelper);

// so a `helperMissing` fallback is not required.
invokeKnownHelper: function(paramSize, name) {
invokeKnownHelper: function invokeKnownHelper(paramSize, name) {
var helper = this.setupHelper(paramSize, name);

@@ -650,3 +660,3 @@ this.push(this.source.functionCall(helper.name, 'call', helper.callParams));

// `knownHelpersOnly` flags at compile-time.
invokeAmbiguous: function(name, helperCall) {
invokeAmbiguous: function invokeAmbiguous(name, helperCall) {
this.useRegister('helper');

@@ -664,14 +674,6 @@

lookup[0] = '(helper = ';
lookup.push(
' != null ? helper : ',
this.aliasable('helpers.helperMissing')
);
lookup.push(' != null ? helper : ', this.aliasable('helpers.helperMissing'));
}
this.push([
'(', lookup,
(helper.paramsInit ? ['),(', helper.paramsInit] : []), '),',
'(typeof helper === ', this.aliasable('"function"'), ' ? ',
this.source.functionCall('helper','call', helper.callParams), ' : helper))'
]);
this.push(['(', lookup, helper.paramsInit ? ['),(', helper.paramsInit] : [], '),', '(typeof helper === ', this.aliasable('"function"'), ' ? ', this.source.functionCall('helper', 'call', helper.callParams), ' : helper))']);
},

@@ -686,3 +688,3 @@

// and pushes the result of the invocation back.
invokePartial: function(isDynamic, name, indent) {
invokePartial: function invokePartial(isDynamic, name, indent) {
var params = [],

@@ -723,7 +725,7 @@ options = this.setupParams(name, 1, params, false);

// Pops a value off the stack and assigns it to the current hash
assignToHash: function(key) {
assignToHash: function assignToHash(key) {
var value = this.popStack(),
context,
type,
id;
context = undefined,
type = undefined,
id = undefined;

@@ -751,7 +753,5 @@ if (this.trackIds) {

pushId: function(type, name, child) {
pushId: function pushId(type, name, child) {
if (type === 'BlockParam') {
this.pushStackLiteral(
'blockParams[' + name[0] + '].path[' + name[1] + ']'
+ (child ? ' + ' + JSON.stringify('.' + child) : ''));
this.pushStackLiteral('blockParams[' + name[0] + '].path[' + name[1] + ']' + (child ? ' + ' + JSON.stringify('.' + child) : ''));
} else if (type === 'PathExpression') {

@@ -770,8 +770,10 @@ this.pushString(name);

compileChildren: function(environment, options) {
var children = environment.children, child, compiler;
compileChildren: function compileChildren(environment, options) {
var children = environment.children,
child = undefined,
compiler = undefined;
for(var i=0, l=children.length; i<l; i++) {
for (var i = 0, l = children.length; i < l; i++) {
child = children[i];
compiler = new this.compiler();
compiler = new this.compiler(); // eslint-disable-line new-cap

@@ -781,3 +783,3 @@ var index = this.matchExistingProgram(child);

if (index == null) {
this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children
this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children
index = this.context.programs.length;

@@ -800,3 +802,3 @@ child.index = index;

},
matchExistingProgram: function(child) {
matchExistingProgram: function matchExistingProgram(child) {
for (var i = 0, len = this.context.environments.length; i < len; i++) {

@@ -810,3 +812,3 @@ var environment = this.context.environments[i];

programExpression: function(guid) {
programExpression: function programExpression(guid) {
var child = this.environment.children[guid],

@@ -825,4 +827,4 @@ programParams = [child.index, 'data', child.blockParams];

useRegister: function(name) {
if(!this.registers[name]) {
useRegister: function useRegister(name) {
if (!this.registers[name]) {
this.registers[name] = true;

@@ -833,3 +835,3 @@ this.registers.list.push(name);

push: function(expr) {
push: function push(expr) {
if (!(expr instanceof Literal)) {

@@ -843,10 +845,9 @@ expr = this.source.wrap(expr);

pushStackLiteral: function(item) {
pushStackLiteral: function pushStackLiteral(item) {
this.push(new Literal(item));
},
pushSource: function(source) {
pushSource: function pushSource(source) {
if (this.pendingContent) {
this.source.push(
this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation));
this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation));
this.pendingContent = undefined;

@@ -860,11 +861,11 @@ }

replaceStack: function(callback) {
replaceStack: function replaceStack(callback) {
var prefix = ['('],
stack,
createdStack,
usedLiteral;
stack = undefined,
createdStack = undefined,
usedLiteral = undefined;
/* istanbul ignore next */
if (!this.isInline()) {
throw new Exception('replaceStack on non-inline');
throw new _Exception2['default']('replaceStack on non-inline');
}

@@ -883,5 +884,5 @@

createdStack = true;
var name = this.incrStack();
var _name = this.incrStack();
prefix = ['((', this.push(name), ' = ', top, ')'];
prefix = ['((', this.push(_name), ' = ', top, ')'];
stack = this.topStack();

@@ -901,11 +902,13 @@ }

incrStack: function() {
incrStack: function incrStack() {
this.stackSlot++;
if(this.stackSlot > this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); }
if (this.stackSlot > this.stackVars.length) {
this.stackVars.push('stack' + this.stackSlot);
}
return this.topStackName();
},
topStackName: function() {
return "stack" + this.stackSlot;
topStackName: function topStackName() {
return 'stack' + this.stackSlot;
},
flushInline: function() {
flushInline: function flushInline() {
var inlineStack = this.inlineStack;

@@ -925,11 +928,11 @@ this.inlineStack = [];

},
isInline: function() {
isInline: function isInline() {
return this.inlineStack.length;
},
popStack: function(wrapped) {
popStack: function popStack(wrapped) {
var inline = this.isInline(),
item = (inline ? this.inlineStack : this.compileStack).pop();
if (!wrapped && (item instanceof Literal)) {
if (!wrapped && item instanceof Literal) {
return item.value;

@@ -940,3 +943,3 @@ } else {

if (!this.stackSlot) {
throw new Exception('Invalid stack pop');
throw new _Exception2['default']('Invalid stack pop');
}

@@ -949,4 +952,4 @@ this.stackSlot--;

topStack: function() {
var stack = (this.isInline() ? this.inlineStack : this.compileStack),
topStack: function topStack() {
var stack = this.isInline() ? this.inlineStack : this.compileStack,
item = stack[stack.length - 1];

@@ -962,3 +965,3 @@

contextName: function(context) {
contextName: function contextName(context) {
if (this.useDepths && context) {

@@ -971,11 +974,11 @@ return 'depths[' + context + ']';

quotedString: function(str) {
quotedString: function quotedString(str) {
return this.source.quotedString(str);
},
objectLiteral: function(obj) {
objectLiteral: function objectLiteral(obj) {
return this.source.objectLiteral(obj);
},
aliasable: function(name) {
aliasable: function aliasable(name) {
var ret = this.aliases[name];

@@ -994,3 +997,3 @@ if (ret) {

setupHelper: function(paramSize, name, blockHelper) {
setupHelper: function setupHelper(paramSize, name, blockHelper) {
var params = [],

@@ -1008,4 +1011,8 @@ paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper);

setupParams: function(helper, paramSize, params) {
var options = {}, contexts = [], types = [], ids = [], param;
setupParams: function setupParams(helper, paramSize, params) {
var options = {},
contexts = [],
types = [],
ids = [],
param = undefined;

@@ -1066,3 +1073,3 @@ options.name = this.quotedString(helper);

setupHelperArgs: function(helper, paramSize, params, useRegister) {
setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister) {
var options = this.setupParams(helper, paramSize, params, true);

@@ -1081,29 +1088,13 @@ options = this.objectLiteral(options);

(function () {
var reservedWords = ('break else new var' + ' case finally return void' + ' catch for switch while' + ' continue function this with' + ' default if throw' + ' delete in try' + ' do instanceof typeof' + ' abstract enum int short' + ' boolean export interface static' + ' byte extends long super' + ' char final native synchronized' + ' class float package throws' + ' const goto private transient' + ' debugger implements protected volatile' + ' double import public let yield await' + ' null true false').split(' ');
var reservedWords = (
"break else new var" +
" case finally return void" +
" catch for switch while" +
" continue function this with" +
" default if throw" +
" delete in try" +
" do instanceof typeof" +
" abstract enum int short" +
" boolean export interface static" +
" byte extends long super" +
" char final native synchronized" +
" class float package throws" +
" const goto private transient" +
" debugger implements protected volatile" +
" double import public let yield await" +
" null true false"
).split(" ");
var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};
var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};
for (var i = 0, l = reservedWords.length; i < l; i++) {
compilerWords[reservedWords[i]] = true;
}
})();
for(var i=0, l=reservedWords.length; i<l; i++) {
compilerWords[reservedWords[i]] = true;
}
JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
JavaScriptCompiler.isValidJavaScriptVariableName = function (name) {
return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name);

@@ -1113,5 +1104,4 @@ };

function strictLookup(requireTerminal, compiler, parts, type) {
var stack = compiler.popStack();
var i = 0,
var stack = compiler.popStack(),
i = 0,
len = parts.length;

@@ -1133,2 +1123,3 @@ if (requireTerminal) {

exports["default"] = JavaScriptCompiler;
exports['default'] = JavaScriptCompiler;
module.exports = exports['default'];
"use strict";
exports.__esModule = true;
/* jshint ignore:start */
/* istanbul ignore next */
/* Jison generated parser */
var handlebars = (function(){
var parser = {trace: function trace() { },
yy: {},
symbols_: {"error":2,"root":3,"program":4,"EOF":5,"program_repetition0":6,"statement":7,"mustache":8,"block":9,"rawBlock":10,"partial":11,"content":12,"COMMENT":13,"CONTENT":14,"openRawBlock":15,"END_RAW_BLOCK":16,"OPEN_RAW_BLOCK":17,"helperName":18,"openRawBlock_repetition0":19,"openRawBlock_option0":20,"CLOSE_RAW_BLOCK":21,"openBlock":22,"block_option0":23,"closeBlock":24,"openInverse":25,"block_option1":26,"OPEN_BLOCK":27,"openBlock_repetition0":28,"openBlock_option0":29,"openBlock_option1":30,"CLOSE":31,"OPEN_INVERSE":32,"openInverse_repetition0":33,"openInverse_option0":34,"openInverse_option1":35,"openInverseChain":36,"OPEN_INVERSE_CHAIN":37,"openInverseChain_repetition0":38,"openInverseChain_option0":39,"openInverseChain_option1":40,"inverseAndProgram":41,"INVERSE":42,"inverseChain":43,"inverseChain_option0":44,"OPEN_ENDBLOCK":45,"OPEN":46,"mustache_repetition0":47,"mustache_option0":48,"OPEN_UNESCAPED":49,"mustache_repetition1":50,"mustache_option1":51,"CLOSE_UNESCAPED":52,"OPEN_PARTIAL":53,"partialName":54,"partial_repetition0":55,"partial_option0":56,"param":57,"sexpr":58,"OPEN_SEXPR":59,"sexpr_repetition0":60,"sexpr_option0":61,"CLOSE_SEXPR":62,"hash":63,"hash_repetition_plus0":64,"hashSegment":65,"ID":66,"EQUALS":67,"blockParams":68,"OPEN_BLOCK_PARAMS":69,"blockParams_repetition_plus0":70,"CLOSE_BLOCK_PARAMS":71,"path":72,"dataName":73,"STRING":74,"NUMBER":75,"BOOLEAN":76,"DATA":77,"pathSegments":78,"SEP":79,"$accept":0,"$end":1},
terminals_: {2:"error",5:"EOF",13:"COMMENT",14:"CONTENT",16:"END_RAW_BLOCK",17:"OPEN_RAW_BLOCK",21:"CLOSE_RAW_BLOCK",27:"OPEN_BLOCK",31:"CLOSE",32:"OPEN_INVERSE",37:"OPEN_INVERSE_CHAIN",42:"INVERSE",45:"OPEN_ENDBLOCK",46:"OPEN",49:"OPEN_UNESCAPED",52:"CLOSE_UNESCAPED",53:"OPEN_PARTIAL",59:"OPEN_SEXPR",62:"CLOSE_SEXPR",66:"ID",67:"EQUALS",69:"OPEN_BLOCK_PARAMS",71:"CLOSE_BLOCK_PARAMS",74:"STRING",75:"NUMBER",76:"BOOLEAN",77:"DATA",79:"SEP"},
productions_: [0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[12,1],[10,3],[15,5],[9,4],[9,4],[22,6],[25,6],[36,6],[41,2],[43,3],[43,1],[24,3],[8,5],[8,5],[11,5],[57,1],[57,1],[58,5],[63,1],[65,3],[68,3],[18,1],[18,1],[18,1],[18,1],[18,1],[54,1],[54,1],[73,2],[72,1],[78,3],[78,1],[6,0],[6,2],[19,0],[19,2],[20,0],[20,1],[23,0],[23,1],[26,0],[26,1],[28,0],[28,2],[29,0],[29,1],[30,0],[30,1],[33,0],[33,2],[34,0],[34,1],[35,0],[35,1],[38,0],[38,2],[39,0],[39,1],[40,0],[40,1],[44,0],[44,1],[47,0],[47,2],[48,0],[48,1],[50,0],[50,2],[51,0],[51,1],[55,0],[55,2],[56,0],[56,1],[60,0],[60,2],[61,0],[61,1],[64,1],[64,2],[70,1],[70,2]],
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
var handlebars = (function () {
var parser = { trace: function trace() {},
yy: {},
symbols_: { error: 2, root: 3, program: 4, EOF: 5, program_repetition0: 6, statement: 7, mustache: 8, block: 9, rawBlock: 10, partial: 11, content: 12, COMMENT: 13, CONTENT: 14, openRawBlock: 15, END_RAW_BLOCK: 16, OPEN_RAW_BLOCK: 17, helperName: 18, openRawBlock_repetition0: 19, openRawBlock_option0: 20, CLOSE_RAW_BLOCK: 21, openBlock: 22, block_option0: 23, closeBlock: 24, openInverse: 25, block_option1: 26, OPEN_BLOCK: 27, openBlock_repetition0: 28, openBlock_option0: 29, openBlock_option1: 30, CLOSE: 31, OPEN_INVERSE: 32, openInverse_repetition0: 33, openInverse_option0: 34, openInverse_option1: 35, openInverseChain: 36, OPEN_INVERSE_CHAIN: 37, openInverseChain_repetition0: 38, openInverseChain_option0: 39, openInverseChain_option1: 40, inverseAndProgram: 41, INVERSE: 42, inverseChain: 43, inverseChain_option0: 44, OPEN_ENDBLOCK: 45, OPEN: 46, mustache_repetition0: 47, mustache_option0: 48, OPEN_UNESCAPED: 49, mustache_repetition1: 50, mustache_option1: 51, CLOSE_UNESCAPED: 52, OPEN_PARTIAL: 53, partialName: 54, partial_repetition0: 55, partial_option0: 56, param: 57, sexpr: 58, OPEN_SEXPR: 59, sexpr_repetition0: 60, sexpr_option0: 61, CLOSE_SEXPR: 62, hash: 63, hash_repetition_plus0: 64, hashSegment: 65, ID: 66, EQUALS: 67, blockParams: 68, OPEN_BLOCK_PARAMS: 69, blockParams_repetition_plus0: 70, CLOSE_BLOCK_PARAMS: 71, path: 72, dataName: 73, STRING: 74, NUMBER: 75, BOOLEAN: 76, UNDEFINED: 77, NULL: 78, DATA: 79, pathSegments: 80, SEP: 81, $accept: 0, $end: 1 },
terminals_: { 2: "error", 5: "EOF", 13: "COMMENT", 14: "CONTENT", 16: "END_RAW_BLOCK", 17: "OPEN_RAW_BLOCK", 21: "CLOSE_RAW_BLOCK", 27: "OPEN_BLOCK", 31: "CLOSE", 32: "OPEN_INVERSE", 37: "OPEN_INVERSE_CHAIN", 42: "INVERSE", 45: "OPEN_ENDBLOCK", 46: "OPEN", 49: "OPEN_UNESCAPED", 52: "CLOSE_UNESCAPED", 53: "OPEN_PARTIAL", 59: "OPEN_SEXPR", 62: "CLOSE_SEXPR", 66: "ID", 67: "EQUALS", 69: "OPEN_BLOCK_PARAMS", 71: "CLOSE_BLOCK_PARAMS", 74: "STRING", 75: "NUMBER", 76: "BOOLEAN", 77: "UNDEFINED", 78: "NULL", 79: "DATA", 81: "SEP" },
productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [12, 1], [10, 3], [15, 5], [9, 4], [9, 4], [22, 6], [25, 6], [36, 6], [41, 2], [43, 3], [43, 1], [24, 3], [8, 5], [8, 5], [11, 5], [57, 1], [57, 1], [58, 5], [63, 1], [65, 3], [68, 3], [18, 1], [18, 1], [18, 1], [18, 1], [18, 1], [18, 1], [18, 1], [54, 1], [54, 1], [73, 2], [72, 1], [80, 3], [80, 1], [6, 0], [6, 2], [19, 0], [19, 2], [20, 0], [20, 1], [23, 0], [23, 1], [26, 0], [26, 1], [28, 0], [28, 2], [29, 0], [29, 1], [30, 0], [30, 1], [33, 0], [33, 2], [34, 0], [34, 1], [35, 0], [35, 1], [38, 0], [38, 2], [39, 0], [39, 1], [40, 0], [40, 1], [44, 0], [44, 1], [47, 0], [47, 2], [48, 0], [48, 1], [50, 0], [50, 2], [51, 0], [51, 1], [55, 0], [55, 2], [56, 0], [56, 1], [60, 0], [60, 2], [61, 0], [61, 1], [64, 1], [64, 2], [70, 1], [70, 2]],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
var $0 = $$.length - 1;
switch (yystate) {
case 1: return $$[$0-1];
break;
case 2:this.$ = new yy.Program($$[$0], null, {}, yy.locInfo(this._$));
break;
case 3:this.$ = $$[$0];
break;
case 4:this.$ = $$[$0];
break;
case 5:this.$ = $$[$0];
break;
case 6:this.$ = $$[$0];
break;
case 7:this.$ = $$[$0];
break;
case 8:this.$ = new yy.CommentStatement(yy.stripComment($$[$0]), yy.stripFlags($$[$0], $$[$0]), yy.locInfo(this._$));
break;
case 9:this.$ = new yy.ContentStatement($$[$0], yy.locInfo(this._$));
break;
case 10:this.$ = yy.prepareRawBlock($$[$0-2], $$[$0-1], $$[$0], this._$);
break;
case 11:this.$ = { path: $$[$0-3], params: $$[$0-2], hash: $$[$0-1] };
break;
case 12:this.$ = yy.prepareBlock($$[$0-3], $$[$0-2], $$[$0-1], $$[$0], false, this._$);
break;
case 13:this.$ = yy.prepareBlock($$[$0-3], $$[$0-2], $$[$0-1], $$[$0], true, this._$);
break;
case 14:this.$ = { path: $$[$0-4], params: $$[$0-3], hash: $$[$0-2], blockParams: $$[$0-1], strip: yy.stripFlags($$[$0-5], $$[$0]) };
break;
case 15:this.$ = { path: $$[$0-4], params: $$[$0-3], hash: $$[$0-2], blockParams: $$[$0-1], strip: yy.stripFlags($$[$0-5], $$[$0]) };
break;
case 16:this.$ = { path: $$[$0-4], params: $$[$0-3], hash: $$[$0-2], blockParams: $$[$0-1], strip: yy.stripFlags($$[$0-5], $$[$0]) };
break;
case 17:this.$ = { strip: yy.stripFlags($$[$0-1], $$[$0-1]), program: $$[$0] };
break;
case 18:
var inverse = yy.prepareBlock($$[$0-2], $$[$0-1], $$[$0], $$[$0], false, this._$),
program = new yy.Program([inverse], null, {}, yy.locInfo(this._$));
program.chained = true;
var $0 = $$.length - 1;
switch (yystate) {
case 1:
return $$[$0 - 1];
break;
case 2:
this.$ = new yy.Program($$[$0], null, {}, yy.locInfo(this._$));
break;
case 3:
this.$ = $$[$0];
break;
case 4:
this.$ = $$[$0];
break;
case 5:
this.$ = $$[$0];
break;
case 6:
this.$ = $$[$0];
break;
case 7:
this.$ = $$[$0];
break;
case 8:
this.$ = new yy.CommentStatement(yy.stripComment($$[$0]), yy.stripFlags($$[$0], $$[$0]), yy.locInfo(this._$));
break;
case 9:
this.$ = new yy.ContentStatement($$[$0], yy.locInfo(this._$));
break;
case 10:
this.$ = yy.prepareRawBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$);
break;
case 11:
this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1] };
break;
case 12:
this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], false, this._$);
break;
case 13:
this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], true, this._$);
break;
case 14:
this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) };
break;
case 15:
this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) };
break;
case 16:
this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) };
break;
case 17:
this.$ = { strip: yy.stripFlags($$[$0 - 1], $$[$0 - 1]), program: $$[$0] };
break;
case 18:
var inverse = yy.prepareBlock($$[$0 - 2], $$[$0 - 1], $$[$0], $$[$0], false, this._$),
program = new yy.Program([inverse], null, {}, yy.locInfo(this._$));
program.chained = true;
this.$ = { strip: $$[$0-2].strip, program: program, chain: true };
break;
case 19:this.$ = $$[$0];
break;
case 20:this.$ = {path: $$[$0-1], strip: yy.stripFlags($$[$0-2], $$[$0])};
break;
case 21:this.$ = yy.prepareMustache($$[$0-3], $$[$0-2], $$[$0-1], $$[$0-4], yy.stripFlags($$[$0-4], $$[$0]), this._$);
break;
case 22:this.$ = yy.prepareMustache($$[$0-3], $$[$0-2], $$[$0-1], $$[$0-4], yy.stripFlags($$[$0-4], $$[$0]), this._$);
break;
case 23:this.$ = new yy.PartialStatement($$[$0-3], $$[$0-2], $$[$0-1], yy.stripFlags($$[$0-4], $$[$0]), yy.locInfo(this._$));
break;
case 24:this.$ = $$[$0];
break;
case 25:this.$ = $$[$0];
break;
case 26:this.$ = new yy.SubExpression($$[$0-3], $$[$0-2], $$[$0-1], yy.locInfo(this._$));
break;
case 27:this.$ = new yy.Hash($$[$0], yy.locInfo(this._$));
break;
case 28:this.$ = new yy.HashPair($$[$0-2], $$[$0], yy.locInfo(this._$));
break;
case 29:this.$ = $$[$0-1];
break;
case 30:this.$ = $$[$0];
break;
case 31:this.$ = $$[$0];
break;
case 32:this.$ = new yy.StringLiteral($$[$0], yy.locInfo(this._$));
break;
case 33:this.$ = new yy.NumberLiteral($$[$0], yy.locInfo(this._$));
break;
case 34:this.$ = new yy.BooleanLiteral($$[$0], yy.locInfo(this._$));
break;
case 35:this.$ = $$[$0];
break;
case 36:this.$ = $$[$0];
break;
case 37:this.$ = yy.preparePath(true, $$[$0], this._$);
break;
case 38:this.$ = yy.preparePath(false, $$[$0], this._$);
break;
case 39: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2];
break;
case 40:this.$ = [{part: $$[$0]}];
break;
case 41:this.$ = [];
break;
case 42:$$[$0-1].push($$[$0]);
break;
case 43:this.$ = [];
break;
case 44:$$[$0-1].push($$[$0]);
break;
case 51:this.$ = [];
break;
case 52:$$[$0-1].push($$[$0]);
break;
case 57:this.$ = [];
break;
case 58:$$[$0-1].push($$[$0]);
break;
case 63:this.$ = [];
break;
case 64:$$[$0-1].push($$[$0]);
break;
case 71:this.$ = [];
break;
case 72:$$[$0-1].push($$[$0]);
break;
case 75:this.$ = [];
break;
case 76:$$[$0-1].push($$[$0]);
break;
case 79:this.$ = [];
break;
case 80:$$[$0-1].push($$[$0]);
break;
case 83:this.$ = [];
break;
case 84:$$[$0-1].push($$[$0]);
break;
case 87:this.$ = [$$[$0]];
break;
case 88:$$[$0-1].push($$[$0]);
break;
case 89:this.$ = [$$[$0]];
break;
case 90:$$[$0-1].push($$[$0]);
break;
}
},
table: [{3:1,4:2,5:[2,41],6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],46:[2,41],49:[2,41],53:[2,41]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:[1,11],14:[1,18],15:16,17:[1,21],22:14,25:15,27:[1,19],32:[1,20],37:[2,2],42:[2,2],45:[2,2],46:[1,12],49:[1,13],53:[1,17]},{1:[2,1]},{5:[2,42],13:[2,42],14:[2,42],17:[2,42],27:[2,42],32:[2,42],37:[2,42],42:[2,42],45:[2,42],46:[2,42],49:[2,42],53:[2,42]},{5:[2,3],13:[2,3],14:[2,3],17:[2,3],27:[2,3],32:[2,3],37:[2,3],42:[2,3],45:[2,3],46:[2,3],49:[2,3],53:[2,3]},{5:[2,4],13:[2,4],14:[2,4],17:[2,4],27:[2,4],32:[2,4],37:[2,4],42:[2,4],45:[2,4],46:[2,4],49:[2,4],53:[2,4]},{5:[2,5],13:[2,5],14:[2,5],17:[2,5],27:[2,5],32:[2,5],37:[2,5],42:[2,5],45:[2,5],46:[2,5],49:[2,5],53:[2,5]},{5:[2,6],13:[2,6],14:[2,6],17:[2,6],27:[2,6],32:[2,6],37:[2,6],42:[2,6],45:[2,6],46:[2,6],49:[2,6],53:[2,6]},{5:[2,7],13:[2,7],14:[2,7],17:[2,7],27:[2,7],32:[2,7],37:[2,7],42:[2,7],45:[2,7],46:[2,7],49:[2,7],53:[2,7]},{5:[2,8],13:[2,8],14:[2,8],17:[2,8],27:[2,8],32:[2,8],37:[2,8],42:[2,8],45:[2,8],46:[2,8],49:[2,8],53:[2,8]},{18:22,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:31,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{4:32,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],37:[2,41],42:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{4:33,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],42:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{12:34,14:[1,18]},{18:36,54:35,58:37,59:[1,38],66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{5:[2,9],13:[2,9],14:[2,9],16:[2,9],17:[2,9],27:[2,9],32:[2,9],37:[2,9],42:[2,9],45:[2,9],46:[2,9],49:[2,9],53:[2,9]},{18:39,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:40,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:41,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{31:[2,71],47:42,59:[2,71],66:[2,71],74:[2,71],75:[2,71],76:[2,71],77:[2,71]},{21:[2,30],31:[2,30],52:[2,30],59:[2,30],62:[2,30],66:[2,30],69:[2,30],74:[2,30],75:[2,30],76:[2,30],77:[2,30]},{21:[2,31],31:[2,31],52:[2,31],59:[2,31],62:[2,31],66:[2,31],69:[2,31],74:[2,31],75:[2,31],76:[2,31],77:[2,31]},{21:[2,32],31:[2,32],52:[2,32],59:[2,32],62:[2,32],66:[2,32],69:[2,32],74:[2,32],75:[2,32],76:[2,32],77:[2,32]},{21:[2,33],31:[2,33],52:[2,33],59:[2,33],62:[2,33],66:[2,33],69:[2,33],74:[2,33],75:[2,33],76:[2,33],77:[2,33]},{21:[2,34],31:[2,34],52:[2,34],59:[2,34],62:[2,34],66:[2,34],69:[2,34],74:[2,34],75:[2,34],76:[2,34],77:[2,34]},{21:[2,38],31:[2,38],52:[2,38],59:[2,38],62:[2,38],66:[2,38],69:[2,38],74:[2,38],75:[2,38],76:[2,38],77:[2,38],79:[1,43]},{66:[1,30],78:44},{21:[2,40],31:[2,40],52:[2,40],59:[2,40],62:[2,40],66:[2,40],69:[2,40],74:[2,40],75:[2,40],76:[2,40],77:[2,40],79:[2,40]},{50:45,52:[2,75],59:[2,75],66:[2,75],74:[2,75],75:[2,75],76:[2,75],77:[2,75]},{23:46,36:48,37:[1,50],41:49,42:[1,51],43:47,45:[2,47]},{26:52,41:53,42:[1,51],45:[2,49]},{16:[1,54]},{31:[2,79],55:55,59:[2,79],66:[2,79],74:[2,79],75:[2,79],76:[2,79],77:[2,79]},{31:[2,35],59:[2,35],66:[2,35],74:[2,35],75:[2,35],76:[2,35],77:[2,35]},{31:[2,36],59:[2,36],66:[2,36],74:[2,36],75:[2,36],76:[2,36],77:[2,36]},{18:56,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{28:57,31:[2,51],59:[2,51],66:[2,51],69:[2,51],74:[2,51],75:[2,51],76:[2,51],77:[2,51]},{31:[2,57],33:58,59:[2,57],66:[2,57],69:[2,57],74:[2,57],75:[2,57],76:[2,57],77:[2,57]},{19:59,21:[2,43],59:[2,43],66:[2,43],74:[2,43],75:[2,43],76:[2,43],77:[2,43]},{18:63,31:[2,73],48:60,57:61,58:64,59:[1,38],63:62,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{66:[1,68]},{21:[2,37],31:[2,37],52:[2,37],59:[2,37],62:[2,37],66:[2,37],69:[2,37],74:[2,37],75:[2,37],76:[2,37],77:[2,37],79:[1,43]},{18:63,51:69,52:[2,77],57:70,58:64,59:[1,38],63:71,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{24:72,45:[1,73]},{45:[2,48]},{4:74,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],37:[2,41],42:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{45:[2,19]},{18:75,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{4:76,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{24:77,45:[1,73]},{45:[2,50]},{5:[2,10],13:[2,10],14:[2,10],17:[2,10],27:[2,10],32:[2,10],37:[2,10],42:[2,10],45:[2,10],46:[2,10],49:[2,10],53:[2,10]},{18:63,31:[2,81],56:78,57:79,58:64,59:[1,38],63:80,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{59:[2,83],60:81,62:[2,83],66:[2,83],74:[2,83],75:[2,83],76:[2,83],77:[2,83]},{18:63,29:82,31:[2,53],57:83,58:64,59:[1,38],63:84,64:65,65:66,66:[1,67],69:[2,53],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:63,31:[2,59],34:85,57:86,58:64,59:[1,38],63:87,64:65,65:66,66:[1,67],69:[2,59],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:63,20:88,21:[2,45],57:89,58:64,59:[1,38],63:90,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{31:[1,91]},{31:[2,72],59:[2,72],66:[2,72],74:[2,72],75:[2,72],76:[2,72],77:[2,72]},{31:[2,74]},{21:[2,24],31:[2,24],52:[2,24],59:[2,24],62:[2,24],66:[2,24],69:[2,24],74:[2,24],75:[2,24],76:[2,24],77:[2,24]},{21:[2,25],31:[2,25],52:[2,25],59:[2,25],62:[2,25],66:[2,25],69:[2,25],74:[2,25],75:[2,25],76:[2,25],77:[2,25]},{21:[2,27],31:[2,27],52:[2,27],62:[2,27],65:92,66:[1,93],69:[2,27]},{21:[2,87],31:[2,87],52:[2,87],62:[2,87],66:[2,87],69:[2,87]},{21:[2,40],31:[2,40],52:[2,40],59:[2,40],62:[2,40],66:[2,40],67:[1,94],69:[2,40],74:[2,40],75:[2,40],76:[2,40],77:[2,40],79:[2,40]},{21:[2,39],31:[2,39],52:[2,39],59:[2,39],62:[2,39],66:[2,39],69:[2,39],74:[2,39],75:[2,39],76:[2,39],77:[2,39],79:[2,39]},{52:[1,95]},{52:[2,76],59:[2,76],66:[2,76],74:[2,76],75:[2,76],76:[2,76],77:[2,76]},{52:[2,78]},{5:[2,12],13:[2,12],14:[2,12],17:[2,12],27:[2,12],32:[2,12],37:[2,12],42:[2,12],45:[2,12],46:[2,12],49:[2,12],53:[2,12]},{18:96,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{36:48,37:[1,50],41:49,42:[1,51],43:98,44:97,45:[2,69]},{31:[2,63],38:99,59:[2,63],66:[2,63],69:[2,63],74:[2,63],75:[2,63],76:[2,63],77:[2,63]},{45:[2,17]},{5:[2,13],13:[2,13],14:[2,13],17:[2,13],27:[2,13],32:[2,13],37:[2,13],42:[2,13],45:[2,13],46:[2,13],49:[2,13],53:[2,13]},{31:[1,100]},{31:[2,80],59:[2,80],66:[2,80],74:[2,80],75:[2,80],76:[2,80],77:[2,80]},{31:[2,82]},{18:63,57:102,58:64,59:[1,38],61:101,62:[2,85],63:103,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{30:104,31:[2,55],68:105,69:[1,106]},{31:[2,52],59:[2,52],66:[2,52],69:[2,52],74:[2,52],75:[2,52],76:[2,52],77:[2,52]},{31:[2,54],69:[2,54]},{31:[2,61],35:107,68:108,69:[1,106]},{31:[2,58],59:[2,58],66:[2,58],69:[2,58],74:[2,58],75:[2,58],76:[2,58],77:[2,58]},{31:[2,60],69:[2,60]},{21:[1,109]},{21:[2,44],59:[2,44],66:[2,44],74:[2,44],75:[2,44],76:[2,44],77:[2,44]},{21:[2,46]},{5:[2,21],13:[2,21],14:[2,21],17:[2,21],27:[2,21],32:[2,21],37:[2,21],42:[2,21],45:[2,21],46:[2,21],49:[2,21],53:[2,21]},{21:[2,88],31:[2,88],52:[2,88],62:[2,88],66:[2,88],69:[2,88]},{67:[1,94]},{18:63,57:110,58:64,59:[1,38],66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{5:[2,22],13:[2,22],14:[2,22],17:[2,22],27:[2,22],32:[2,22],37:[2,22],42:[2,22],45:[2,22],46:[2,22],49:[2,22],53:[2,22]},{31:[1,111]},{45:[2,18]},{45:[2,70]},{18:63,31:[2,65],39:112,57:113,58:64,59:[1,38],63:114,64:65,65:66,66:[1,67],69:[2,65],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{5:[2,23],13:[2,23],14:[2,23],17:[2,23],27:[2,23],32:[2,23],37:[2,23],42:[2,23],45:[2,23],46:[2,23],49:[2,23],53:[2,23]},{62:[1,115]},{59:[2,84],62:[2,84],66:[2,84],74:[2,84],75:[2,84],76:[2,84],77:[2,84]},{62:[2,86]},{31:[1,116]},{31:[2,56]},{66:[1,118],70:117},{31:[1,119]},{31:[2,62]},{14:[2,11]},{21:[2,28],31:[2,28],52:[2,28],62:[2,28],66:[2,28],69:[2,28]},{5:[2,20],13:[2,20],14:[2,20],17:[2,20],27:[2,20],32:[2,20],37:[2,20],42:[2,20],45:[2,20],46:[2,20],49:[2,20],53:[2,20]},{31:[2,67],40:120,68:121,69:[1,106]},{31:[2,64],59:[2,64],66:[2,64],69:[2,64],74:[2,64],75:[2,64],76:[2,64],77:[2,64]},{31:[2,66],69:[2,66]},{21:[2,26],31:[2,26],52:[2,26],59:[2,26],62:[2,26],66:[2,26],69:[2,26],74:[2,26],75:[2,26],76:[2,26],77:[2,26]},{13:[2,14],14:[2,14],17:[2,14],27:[2,14],32:[2,14],37:[2,14],42:[2,14],45:[2,14],46:[2,14],49:[2,14],53:[2,14]},{66:[1,123],71:[1,122]},{66:[2,89],71:[2,89]},{13:[2,15],14:[2,15],17:[2,15],27:[2,15],32:[2,15],42:[2,15],45:[2,15],46:[2,15],49:[2,15],53:[2,15]},{31:[1,124]},{31:[2,68]},{31:[2,29]},{66:[2,90],71:[2,90]},{13:[2,16],14:[2,16],17:[2,16],27:[2,16],32:[2,16],37:[2,16],42:[2,16],45:[2,16],46:[2,16],49:[2,16],53:[2,16]}],
defaultActions: {4:[2,1],47:[2,48],49:[2,19],53:[2,50],62:[2,74],71:[2,78],76:[2,17],80:[2,82],90:[2,46],97:[2,18],98:[2,70],103:[2,86],105:[2,56],108:[2,62],109:[2,11],121:[2,68],122:[2,29]},
parseError: function parseError(str, hash) {
throw new Error(str);
},
parse: function parse(input) {
var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
this.lexer.setInput(input);
this.lexer.yy = this.yy;
this.yy.lexer = this.lexer;
this.yy.parser = this;
if (typeof this.lexer.yylloc == "undefined")
this.lexer.yylloc = {};
var yyloc = this.lexer.yylloc;
lstack.push(yyloc);
var ranges = this.lexer.options && this.lexer.options.ranges;
if (typeof this.yy.parseError === "function")
this.parseError = this.yy.parseError;
function popStack(n) {
stack.length = stack.length - 2 * n;
vstack.length = vstack.length - n;
lstack.length = lstack.length - n;
}
function lex() {
var token;
token = self.lexer.lex() || 1;
if (typeof token !== "number") {
token = self.symbols_[token] || token;
}
return token;
}
var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
while (true) {
state = stack[stack.length - 1];
if (this.defaultActions[state]) {
action = this.defaultActions[state];
} else {
if (symbol === null || typeof symbol == "undefined") {
symbol = lex();
this.$ = { strip: $$[$0 - 2].strip, program: program, chain: true };
break;
case 19:
this.$ = $$[$0];
break;
case 20:
this.$ = { path: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 2], $$[$0]) };
break;
case 21:
this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$);
break;
case 22:
this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$);
break;
case 23:
this.$ = new yy.PartialStatement($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], yy.stripFlags($$[$0 - 4], $$[$0]), yy.locInfo(this._$));
break;
case 24:
this.$ = $$[$0];
break;
case 25:
this.$ = $$[$0];
break;
case 26:
this.$ = new yy.SubExpression($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], yy.locInfo(this._$));
break;
case 27:
this.$ = new yy.Hash($$[$0], yy.locInfo(this._$));
break;
case 28:
this.$ = new yy.HashPair(yy.id($$[$0 - 2]), $$[$0], yy.locInfo(this._$));
break;
case 29:
this.$ = yy.id($$[$0 - 1]);
break;
case 30:
this.$ = $$[$0];
break;
case 31:
this.$ = $$[$0];
break;
case 32:
this.$ = new yy.StringLiteral($$[$0], yy.locInfo(this._$));
break;
case 33:
this.$ = new yy.NumberLiteral($$[$0], yy.locInfo(this._$));
break;
case 34:
this.$ = new yy.BooleanLiteral($$[$0], yy.locInfo(this._$));
break;
case 35:
this.$ = new yy.UndefinedLiteral(yy.locInfo(this._$));
break;
case 36:
this.$ = new yy.NullLiteral(yy.locInfo(this._$));
break;
case 37:
this.$ = $$[$0];
break;
case 38:
this.$ = $$[$0];
break;
case 39:
this.$ = yy.preparePath(true, $$[$0], this._$);
break;
case 40:
this.$ = yy.preparePath(false, $$[$0], this._$);
break;
case 41:
$$[$0 - 2].push({ part: yy.id($$[$0]), original: $$[$0], separator: $$[$0 - 1] });this.$ = $$[$0 - 2];
break;
case 42:
this.$ = [{ part: yy.id($$[$0]), original: $$[$0] }];
break;
case 43:
this.$ = [];
break;
case 44:
$$[$0 - 1].push($$[$0]);
break;
case 45:
this.$ = [];
break;
case 46:
$$[$0 - 1].push($$[$0]);
break;
case 53:
this.$ = [];
break;
case 54:
$$[$0 - 1].push($$[$0]);
break;
case 59:
this.$ = [];
break;
case 60:
$$[$0 - 1].push($$[$0]);
break;
case 65:
this.$ = [];
break;
case 66:
$$[$0 - 1].push($$[$0]);
break;
case 73:
this.$ = [];
break;
case 74:
$$[$0 - 1].push($$[$0]);
break;
case 77:
this.$ = [];
break;
case 78:
$$[$0 - 1].push($$[$0]);
break;
case 81:
this.$ = [];
break;
case 82:
$$[$0 - 1].push($$[$0]);
break;
case 85:
this.$ = [];
break;
case 86:
$$[$0 - 1].push($$[$0]);
break;
case 89:
this.$ = [$$[$0]];
break;
case 90:
$$[$0 - 1].push($$[$0]);
break;
case 91:
this.$ = [$$[$0]];
break;
case 92:
$$[$0 - 1].push($$[$0]);
break;
}
action = table[state] && table[state][symbol];
}
if (typeof action === "undefined" || !action.length || !action[0]) {
var errStr = "";
if (!recovering) {
expected = [];
for (p in table[state])
if (this.terminals_[p] && p > 2) {
expected.push("'" + this.terminals_[p] + "'");
},
table: [{ 3: 1, 4: 2, 5: [2, 43], 6: 3, 13: [2, 43], 14: [2, 43], 17: [2, 43], 27: [2, 43], 32: [2, 43], 46: [2, 43], 49: [2, 43], 53: [2, 43] }, { 1: [3] }, { 5: [1, 4] }, { 5: [2, 2], 7: 5, 8: 6, 9: 7, 10: 8, 11: 9, 12: 10, 13: [1, 11], 14: [1, 18], 15: 16, 17: [1, 21], 22: 14, 25: 15, 27: [1, 19], 32: [1, 20], 37: [2, 2], 42: [2, 2], 45: [2, 2], 46: [1, 12], 49: [1, 13], 53: [1, 17] }, { 1: [2, 1] }, { 5: [2, 44], 13: [2, 44], 14: [2, 44], 17: [2, 44], 27: [2, 44], 32: [2, 44], 37: [2, 44], 42: [2, 44], 45: [2, 44], 46: [2, 44], 49: [2, 44], 53: [2, 44] }, { 5: [2, 3], 13: [2, 3], 14: [2, 3], 17: [2, 3], 27: [2, 3], 32: [2, 3], 37: [2, 3], 42: [2, 3], 45: [2, 3], 46: [2, 3], 49: [2, 3], 53: [2, 3] }, { 5: [2, 4], 13: [2, 4], 14: [2, 4], 17: [2, 4], 27: [2, 4], 32: [2, 4], 37: [2, 4], 42: [2, 4], 45: [2, 4], 46: [2, 4], 49: [2, 4], 53: [2, 4] }, { 5: [2, 5], 13: [2, 5], 14: [2, 5], 17: [2, 5], 27: [2, 5], 32: [2, 5], 37: [2, 5], 42: [2, 5], 45: [2, 5], 46: [2, 5], 49: [2, 5], 53: [2, 5] }, { 5: [2, 6], 13: [2, 6], 14: [2, 6], 17: [2, 6], 27: [2, 6], 32: [2, 6], 37: [2, 6], 42: [2, 6], 45: [2, 6], 46: [2, 6], 49: [2, 6], 53: [2, 6] }, { 5: [2, 7], 13: [2, 7], 14: [2, 7], 17: [2, 7], 27: [2, 7], 32: [2, 7], 37: [2, 7], 42: [2, 7], 45: [2, 7], 46: [2, 7], 49: [2, 7], 53: [2, 7] }, { 5: [2, 8], 13: [2, 8], 14: [2, 8], 17: [2, 8], 27: [2, 8], 32: [2, 8], 37: [2, 8], 42: [2, 8], 45: [2, 8], 46: [2, 8], 49: [2, 8], 53: [2, 8] }, { 18: 22, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 18: 33, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 4: 34, 6: 3, 13: [2, 43], 14: [2, 43], 17: [2, 43], 27: [2, 43], 32: [2, 43], 37: [2, 43], 42: [2, 43], 45: [2, 43], 46: [2, 43], 49: [2, 43], 53: [2, 43] }, { 4: 35, 6: 3, 13: [2, 43], 14: [2, 43], 17: [2, 43], 27: [2, 43], 32: [2, 43], 42: [2, 43], 45: [2, 43], 46: [2, 43], 49: [2, 43], 53: [2, 43] }, { 12: 36, 14: [1, 18] }, { 18: 38, 54: 37, 58: 39, 59: [1, 40], 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 5: [2, 9], 13: [2, 9], 14: [2, 9], 16: [2, 9], 17: [2, 9], 27: [2, 9], 32: [2, 9], 37: [2, 9], 42: [2, 9], 45: [2, 9], 46: [2, 9], 49: [2, 9], 53: [2, 9] }, { 18: 41, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 18: 42, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 18: 43, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 31: [2, 73], 47: 44, 59: [2, 73], 66: [2, 73], 74: [2, 73], 75: [2, 73], 76: [2, 73], 77: [2, 73], 78: [2, 73], 79: [2, 73] }, { 21: [2, 30], 31: [2, 30], 52: [2, 30], 59: [2, 30], 62: [2, 30], 66: [2, 30], 69: [2, 30], 74: [2, 30], 75: [2, 30], 76: [2, 30], 77: [2, 30], 78: [2, 30], 79: [2, 30] }, { 21: [2, 31], 31: [2, 31], 52: [2, 31], 59: [2, 31], 62: [2, 31], 66: [2, 31], 69: [2, 31], 74: [2, 31], 75: [2, 31], 76: [2, 31], 77: [2, 31], 78: [2, 31], 79: [2, 31] }, { 21: [2, 32], 31: [2, 32], 52: [2, 32], 59: [2, 32], 62: [2, 32], 66: [2, 32], 69: [2, 32], 74: [2, 32], 75: [2, 32], 76: [2, 32], 77: [2, 32], 78: [2, 32], 79: [2, 32] }, { 21: [2, 33], 31: [2, 33], 52: [2, 33], 59: [2, 33], 62: [2, 33], 66: [2, 33], 69: [2, 33], 74: [2, 33], 75: [2, 33], 76: [2, 33], 77: [2, 33], 78: [2, 33], 79: [2, 33] }, { 21: [2, 34], 31: [2, 34], 52: [2, 34], 59: [2, 34], 62: [2, 34], 66: [2, 34], 69: [2, 34], 74: [2, 34], 75: [2, 34], 76: [2, 34], 77: [2, 34], 78: [2, 34], 79: [2, 34] }, { 21: [2, 35], 31: [2, 35], 52: [2, 35], 59: [2, 35], 62: [2, 35], 66: [2, 35], 69: [2, 35], 74: [2, 35], 75: [2, 35], 76: [2, 35], 77: [2, 35], 78: [2, 35], 79: [2, 35] }, { 21: [2, 36], 31: [2, 36], 52: [2, 36], 59: [2, 36], 62: [2, 36], 66: [2, 36], 69: [2, 36], 74: [2, 36], 75: [2, 36], 76: [2, 36], 77: [2, 36], 78: [2, 36], 79: [2, 36] }, { 21: [2, 40], 31: [2, 40], 52: [2, 40], 59: [2, 40], 62: [2, 40], 66: [2, 40], 69: [2, 40], 74: [2, 40], 75: [2, 40], 76: [2, 40], 77: [2, 40], 78: [2, 40], 79: [2, 40], 81: [1, 45] }, { 66: [1, 32], 80: 46 }, { 21: [2, 42], 31: [2, 42], 52: [2, 42], 59: [2, 42], 62: [2, 42], 66: [2, 42], 69: [2, 42], 74: [2, 42], 75: [2, 42], 76: [2, 42], 77: [2, 42], 78: [2, 42], 79: [2, 42], 81: [2, 42] }, { 50: 47, 52: [2, 77], 59: [2, 77], 66: [2, 77], 74: [2, 77], 75: [2, 77], 76: [2, 77], 77: [2, 77], 78: [2, 77], 79: [2, 77] }, { 23: 48, 36: 50, 37: [1, 52], 41: 51, 42: [1, 53], 43: 49, 45: [2, 49] }, { 26: 54, 41: 55, 42: [1, 53], 45: [2, 51] }, { 16: [1, 56] }, { 31: [2, 81], 55: 57, 59: [2, 81], 66: [2, 81], 74: [2, 81], 75: [2, 81], 76: [2, 81], 77: [2, 81], 78: [2, 81], 79: [2, 81] }, { 31: [2, 37], 59: [2, 37], 66: [2, 37], 74: [2, 37], 75: [2, 37], 76: [2, 37], 77: [2, 37], 78: [2, 37], 79: [2, 37] }, { 31: [2, 38], 59: [2, 38], 66: [2, 38], 74: [2, 38], 75: [2, 38], 76: [2, 38], 77: [2, 38], 78: [2, 38], 79: [2, 38] }, { 18: 58, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 28: 59, 31: [2, 53], 59: [2, 53], 66: [2, 53], 69: [2, 53], 74: [2, 53], 75: [2, 53], 76: [2, 53], 77: [2, 53], 78: [2, 53], 79: [2, 53] }, { 31: [2, 59], 33: 60, 59: [2, 59], 66: [2, 59], 69: [2, 59], 74: [2, 59], 75: [2, 59], 76: [2, 59], 77: [2, 59], 78: [2, 59], 79: [2, 59] }, { 19: 61, 21: [2, 45], 59: [2, 45], 66: [2, 45], 74: [2, 45], 75: [2, 45], 76: [2, 45], 77: [2, 45], 78: [2, 45], 79: [2, 45] }, { 18: 65, 31: [2, 75], 48: 62, 57: 63, 58: 66, 59: [1, 40], 63: 64, 64: 67, 65: 68, 66: [1, 69], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 66: [1, 70] }, { 21: [2, 39], 31: [2, 39], 52: [2, 39], 59: [2, 39], 62: [2, 39], 66: [2, 39], 69: [2, 39], 74: [2, 39], 75: [2, 39], 76: [2, 39], 77: [2, 39], 78: [2, 39], 79: [2, 39], 81: [1, 45] }, { 18: 65, 51: 71, 52: [2, 79], 57: 72, 58: 66, 59: [1, 40], 63: 73, 64: 67, 65: 68, 66: [1, 69], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 24: 74, 45: [1, 75] }, { 45: [2, 50] }, { 4: 76, 6: 3, 13: [2, 43], 14: [2, 43], 17: [2, 43], 27: [2, 43], 32: [2, 43], 37: [2, 43], 42: [2, 43], 45: [2, 43], 46: [2, 43], 49: [2, 43], 53: [2, 43] }, { 45: [2, 19] }, { 18: 77, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 4: 78, 6: 3, 13: [2, 43], 14: [2, 43], 17: [2, 43], 27: [2, 43], 32: [2, 43], 45: [2, 43], 46: [2, 43], 49: [2, 43], 53: [2, 43] }, { 24: 79, 45: [1, 75] }, { 45: [2, 52] }, { 5: [2, 10], 13: [2, 10], 14: [2, 10], 17: [2, 10], 27: [2, 10], 32: [2, 10], 37: [2, 10], 42: [2, 10], 45: [2, 10], 46: [2, 10], 49: [2, 10], 53: [2, 10] }, { 18: 65, 31: [2, 83], 56: 80, 57: 81, 58: 66, 59: [1, 40], 63: 82, 64: 67, 65: 68, 66: [1, 69], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 59: [2, 85], 60: 83, 62: [2, 85], 66: [2, 85], 74: [2, 85], 75: [2, 85], 76: [2, 85], 77: [2, 85], 78: [2, 85], 79: [2, 85] }, { 18: 65, 29: 84, 31: [2, 55], 57: 85, 58: 66, 59: [1, 40], 63: 86, 64: 67, 65: 68, 66: [1, 69], 69: [2, 55], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 18: 65, 31: [2, 61], 34: 87, 57: 88, 58: 66, 59: [1, 40], 63: 89, 64: 67, 65: 68, 66: [1, 69], 69: [2, 61], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 18: 65, 20: 90, 21: [2, 47], 57: 91, 58: 66, 59: [1, 40], 63: 92, 64: 67, 65: 68, 66: [1, 69], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 31: [1, 93] }, { 31: [2, 74], 59: [2, 74], 66: [2, 74], 74: [2, 74], 75: [2, 74], 76: [2, 74], 77: [2, 74], 78: [2, 74], 79: [2, 74] }, { 31: [2, 76] }, { 21: [2, 24], 31: [2, 24], 52: [2, 24], 59: [2, 24], 62: [2, 24], 66: [2, 24], 69: [2, 24], 74: [2, 24], 75: [2, 24], 76: [2, 24], 77: [2, 24], 78: [2, 24], 79: [2, 24] }, { 21: [2, 25], 31: [2, 25], 52: [2, 25], 59: [2, 25], 62: [2, 25], 66: [2, 25], 69: [2, 25], 74: [2, 25], 75: [2, 25], 76: [2, 25], 77: [2, 25], 78: [2, 25], 79: [2, 25] }, { 21: [2, 27], 31: [2, 27], 52: [2, 27], 62: [2, 27], 65: 94, 66: [1, 95], 69: [2, 27] }, { 21: [2, 89], 31: [2, 89], 52: [2, 89], 62: [2, 89], 66: [2, 89], 69: [2, 89] }, { 21: [2, 42], 31: [2, 42], 52: [2, 42], 59: [2, 42], 62: [2, 42], 66: [2, 42], 67: [1, 96], 69: [2, 42], 74: [2, 42], 75: [2, 42], 76: [2, 42], 77: [2, 42], 78: [2, 42], 79: [2, 42], 81: [2, 42] }, { 21: [2, 41], 31: [2, 41], 52: [2, 41], 59: [2, 41], 62: [2, 41], 66: [2, 41], 69: [2, 41], 74: [2, 41], 75: [2, 41], 76: [2, 41], 77: [2, 41], 78: [2, 41], 79: [2, 41], 81: [2, 41] }, { 52: [1, 97] }, { 52: [2, 78], 59: [2, 78], 66: [2, 78], 74: [2, 78], 75: [2, 78], 76: [2, 78], 77: [2, 78], 78: [2, 78], 79: [2, 78] }, { 52: [2, 80] }, { 5: [2, 12], 13: [2, 12], 14: [2, 12], 17: [2, 12], 27: [2, 12], 32: [2, 12], 37: [2, 12], 42: [2, 12], 45: [2, 12], 46: [2, 12], 49: [2, 12], 53: [2, 12] }, { 18: 98, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 36: 50, 37: [1, 52], 41: 51, 42: [1, 53], 43: 100, 44: 99, 45: [2, 71] }, { 31: [2, 65], 38: 101, 59: [2, 65], 66: [2, 65], 69: [2, 65], 74: [2, 65], 75: [2, 65], 76: [2, 65], 77: [2, 65], 78: [2, 65], 79: [2, 65] }, { 45: [2, 17] }, { 5: [2, 13], 13: [2, 13], 14: [2, 13], 17: [2, 13], 27: [2, 13], 32: [2, 13], 37: [2, 13], 42: [2, 13], 45: [2, 13], 46: [2, 13], 49: [2, 13], 53: [2, 13] }, { 31: [1, 102] }, { 31: [2, 82], 59: [2, 82], 66: [2, 82], 74: [2, 82], 75: [2, 82], 76: [2, 82], 77: [2, 82], 78: [2, 82], 79: [2, 82] }, { 31: [2, 84] }, { 18: 65, 57: 104, 58: 66, 59: [1, 40], 61: 103, 62: [2, 87], 63: 105, 64: 67, 65: 68, 66: [1, 69], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 30: 106, 31: [2, 57], 68: 107, 69: [1, 108] }, { 31: [2, 54], 59: [2, 54], 66: [2, 54], 69: [2, 54], 74: [2, 54], 75: [2, 54], 76: [2, 54], 77: [2, 54], 78: [2, 54], 79: [2, 54] }, { 31: [2, 56], 69: [2, 56] }, { 31: [2, 63], 35: 109, 68: 110, 69: [1, 108] }, { 31: [2, 60], 59: [2, 60], 66: [2, 60], 69: [2, 60], 74: [2, 60], 75: [2, 60], 76: [2, 60], 77: [2, 60], 78: [2, 60], 79: [2, 60] }, { 31: [2, 62], 69: [2, 62] }, { 21: [1, 111] }, { 21: [2, 46], 59: [2, 46], 66: [2, 46], 74: [2, 46], 75: [2, 46], 76: [2, 46], 77: [2, 46], 78: [2, 46], 79: [2, 46] }, { 21: [2, 48] }, { 5: [2, 21], 13: [2, 21], 14: [2, 21], 17: [2, 21], 27: [2, 21], 32: [2, 21], 37: [2, 21], 42: [2, 21], 45: [2, 21], 46: [2, 21], 49: [2, 21], 53: [2, 21] }, { 21: [2, 90], 31: [2, 90], 52: [2, 90], 62: [2, 90], 66: [2, 90], 69: [2, 90] }, { 67: [1, 96] }, { 18: 65, 57: 112, 58: 66, 59: [1, 40], 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 5: [2, 22], 13: [2, 22], 14: [2, 22], 17: [2, 22], 27: [2, 22], 32: [2, 22], 37: [2, 22], 42: [2, 22], 45: [2, 22], 46: [2, 22], 49: [2, 22], 53: [2, 22] }, { 31: [1, 113] }, { 45: [2, 18] }, { 45: [2, 72] }, { 18: 65, 31: [2, 67], 39: 114, 57: 115, 58: 66, 59: [1, 40], 63: 116, 64: 67, 65: 68, 66: [1, 69], 69: [2, 67], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 5: [2, 23], 13: [2, 23], 14: [2, 23], 17: [2, 23], 27: [2, 23], 32: [2, 23], 37: [2, 23], 42: [2, 23], 45: [2, 23], 46: [2, 23], 49: [2, 23], 53: [2, 23] }, { 62: [1, 117] }, { 59: [2, 86], 62: [2, 86], 66: [2, 86], 74: [2, 86], 75: [2, 86], 76: [2, 86], 77: [2, 86], 78: [2, 86], 79: [2, 86] }, { 62: [2, 88] }, { 31: [1, 118] }, { 31: [2, 58] }, { 66: [1, 120], 70: 119 }, { 31: [1, 121] }, { 31: [2, 64] }, { 14: [2, 11] }, { 21: [2, 28], 31: [2, 28], 52: [2, 28], 62: [2, 28], 66: [2, 28], 69: [2, 28] }, { 5: [2, 20], 13: [2, 20], 14: [2, 20], 17: [2, 20], 27: [2, 20], 32: [2, 20], 37: [2, 20], 42: [2, 20], 45: [2, 20], 46: [2, 20], 49: [2, 20], 53: [2, 20] }, { 31: [2, 69], 40: 122, 68: 123, 69: [1, 108] }, { 31: [2, 66], 59: [2, 66], 66: [2, 66], 69: [2, 66], 74: [2, 66], 75: [2, 66], 76: [2, 66], 77: [2, 66], 78: [2, 66], 79: [2, 66] }, { 31: [2, 68], 69: [2, 68] }, { 21: [2, 26], 31: [2, 26], 52: [2, 26], 59: [2, 26], 62: [2, 26], 66: [2, 26], 69: [2, 26], 74: [2, 26], 75: [2, 26], 76: [2, 26], 77: [2, 26], 78: [2, 26], 79: [2, 26] }, { 13: [2, 14], 14: [2, 14], 17: [2, 14], 27: [2, 14], 32: [2, 14], 37: [2, 14], 42: [2, 14], 45: [2, 14], 46: [2, 14], 49: [2, 14], 53: [2, 14] }, { 66: [1, 125], 71: [1, 124] }, { 66: [2, 91], 71: [2, 91] }, { 13: [2, 15], 14: [2, 15], 17: [2, 15], 27: [2, 15], 32: [2, 15], 42: [2, 15], 45: [2, 15], 46: [2, 15], 49: [2, 15], 53: [2, 15] }, { 31: [1, 126] }, { 31: [2, 70] }, { 31: [2, 29] }, { 66: [2, 92], 71: [2, 92] }, { 13: [2, 16], 14: [2, 16], 17: [2, 16], 27: [2, 16], 32: [2, 16], 37: [2, 16], 42: [2, 16], 45: [2, 16], 46: [2, 16], 49: [2, 16], 53: [2, 16] }],
defaultActions: { 4: [2, 1], 49: [2, 50], 51: [2, 19], 55: [2, 52], 64: [2, 76], 73: [2, 80], 78: [2, 17], 82: [2, 84], 92: [2, 48], 99: [2, 18], 100: [2, 72], 105: [2, 88], 107: [2, 58], 110: [2, 64], 111: [2, 11], 123: [2, 70], 124: [2, 29] },
parseError: function parseError(str, hash) {
throw new Error(str);
},
parse: function parse(input) {
var self = this,
stack = [0],
vstack = [null],
lstack = [],
table = this.table,
yytext = "",
yylineno = 0,
yyleng = 0,
recovering = 0,
TERROR = 2,
EOF = 1;
this.lexer.setInput(input);
this.lexer.yy = this.yy;
this.yy.lexer = this.lexer;
this.yy.parser = this;
if (typeof this.lexer.yylloc == "undefined") this.lexer.yylloc = {};
var yyloc = this.lexer.yylloc;
lstack.push(yyloc);
var ranges = this.lexer.options && this.lexer.options.ranges;
if (typeof this.yy.parseError === "function") this.parseError = this.yy.parseError;
function popStack(n) {
stack.length = stack.length - 2 * n;
vstack.length = vstack.length - n;
lstack.length = lstack.length - n;
}
function lex() {
var token;
token = self.lexer.lex() || 1;
if (typeof token !== "number") {
token = self.symbols_[token] || token;
}
return token;
}
var symbol,
preErrorSymbol,
state,
action,
a,
r,
yyval = {},
p,
len,
newState,
expected;
while (true) {
state = stack[stack.length - 1];
if (this.defaultActions[state]) {
action = this.defaultActions[state];
} else {
if (symbol === null || typeof symbol == "undefined") {
symbol = lex();
}
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) + "'");
action = table[state] && table[state][symbol];
}
this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});
if (typeof action === "undefined" || !action.length || !action[0]) {
var errStr = "";
if (!recovering) {
expected = [];
for (p in table[state]) if (this.terminals_[p] && p > 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;
}
}
}
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;
}
};
/* 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]++;
};
/* 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 setInput(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 input() {
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 = this._input.slice(1);
return ch;
},
unput: function unput(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);
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;
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
};
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;
if (this.options.ranges) {
this.yylloc.range = [r[0], r[0] + this.yyleng - len];
}
return this;
},
more: function more() {
this._more = true;
return this;
},
less: function less(n) {
this.unput(this.match.slice(n));
},
pastInput: function pastInput() {
var past = this.matched.substr(0, this.matched.length - this.match.length);
return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
},
upcomingInput: function upcomingInput() {
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 showPosition() {
var pre = this.pastInput();
var c = new Array(pre.length + 1).join("-");
return pre + this.upcomingInput() + "\n" + c + "^";
},
next: function next() {
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;
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 topState() {
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);
}
}
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) {
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;
function strip(start, end) {
return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng-end);
}
break;
case 3:
yy_.yytext = yy_.yytext.substr(5, yy_.yyleng - 9);
this.popState();
return 16;
break;
case 4:
return 14;
break;
case 5:
this.popState();
return 13;
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:
yy_.yytext = yy_.yytext.substr(5, yy_.yyleng-9);
this.popState();
return 16;
break;
case 4: return 14;
break;
case 5:
this.popState();
return 13;
break;
case 6:
return 59;
break;
case 7:
return 62;
break;
case 8:
return 17;
break;
case 9:
this.popState();
this.begin("raw");
return 21;
break;
case 6:return 59;
break;
case 7:return 62;
break;
case 8: return 17;
break;
case 9:
this.popState();
this.begin('raw');
return 21;
break;
case 10:return 53;
break;
case 11:return 27;
break;
case 12:return 45;
break;
case 13:this.popState(); return 42;
break;
case 14:this.popState(); return 42;
break;
case 15:return 32;
break;
case 16:return 37;
break;
case 17:return 49;
break;
case 18:return 46;
break;
case 19:
this.unput(yy_.yytext);
this.popState();
this.begin('com');
break;
case 10:
return 53;
break;
case 11:
return 27;
break;
case 12:
return 45;
break;
case 13:
this.popState();return 42;
break;
case 14:
this.popState();return 42;
break;
case 15:
return 32;
break;
case 16:
return 37;
break;
case 17:
return 49;
break;
case 18:
return 46;
break;
case 19:
this.unput(yy_.yytext);
this.popState();
this.begin("com");
break;
case 20:
this.popState();
return 13;
break;
case 20:
this.popState();
return 13;
break;
case 21:return 46;
break;
case 22:return 67;
break;
case 23:return 66;
break;
case 24:return 66;
break;
case 25:return 79;
break;
case 26:// ignore whitespace
break;
case 27:this.popState(); return 52;
break;
case 28:this.popState(); return 31;
break;
case 29:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 74;
break;
case 30:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 74;
break;
case 31:return 77;
break;
case 32:return 76;
break;
case 33:return 76;
break;
case 34:return 75;
break;
case 35:return 69;
break;
case 36:return 71;
break;
case 37:return 66;
break;
case 38:yy_.yytext = strip(1,2); return 66;
break;
case 39:return 'INVALID';
break;
case 40:return 5;
break;
}
};
lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/];
lexer.conditions = {"mu":{"rules":[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,33,34,35,36,37,38,39,40],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[5],"inclusive":false},"raw":{"rules":[3,4],"inclusive":false},"INITIAL":{"rules":[0,1,40],"inclusive":true}};
return lexer;})()
parser.lexer = lexer;
function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser;
return new Parser;
break;
case 21:
return 46;
break;
case 22:
return 67;
break;
case 23:
return 66;
break;
case 24:
return 66;
break;
case 25:
return 81;
break;
case 26:
// ignore whitespace
break;
case 27:
this.popState();return 52;
break;
case 28:
this.popState();return 31;
break;
case 29:
yy_.yytext = strip(1, 2).replace(/\\"/g, "\"");return 74;
break;
case 30:
yy_.yytext = strip(1, 2).replace(/\\'/g, "'");return 74;
break;
case 31:
return 79;
break;
case 32:
return 76;
break;
case 33:
return 76;
break;
case 34:
return 77;
break;
case 35:
return 78;
break;
case 36:
return 75;
break;
case 37:
return 69;
break;
case 38:
return 71;
break;
case 39:
return 66;
break;
case 40:
return 66;
break;
case 41:
return "INVALID";
break;
case 42:
return 5;
break;
}
};
lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]*?(?=(\{\{\{\{\/)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[[^\]]*\])/, /^(?:.)/, /^(?:$)/];
lexer.conditions = { mu: { rules: [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, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42], inclusive: false }, emu: { rules: [2], inclusive: false }, com: { rules: [5], inclusive: false }, raw: { rules: [3, 4], inclusive: false }, INITIAL: { rules: [0, 1, 42], 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 */
/* jshint ignore:end */
module.exports = exports["default"];

@@ -1,4 +0,14 @@

"use strict";
var Visitor = require("./visitor")["default"];
'use strict';
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };
exports.__esModule = true;
exports.print = print;
exports.PrintVisitor = PrintVisitor;
/*eslint-disable new-cap */
var _Visitor = require('./visitor');
var _Visitor2 = _interopRequireWildcard(_Visitor);
function print(ast) {

@@ -8,28 +18,29 @@ return new PrintVisitor().accept(ast);

exports.print = print;function PrintVisitor() {
function PrintVisitor() {
this.padding = 0;
}
exports.PrintVisitor = PrintVisitor;PrintVisitor.prototype = new Visitor();
PrintVisitor.prototype = new _Visitor2['default']();
PrintVisitor.prototype.pad = function(string) {
var out = "";
PrintVisitor.prototype.pad = function (string) {
var out = '';
for(var i=0,l=this.padding; i<l; i++) {
out = out + " ";
for (var i = 0, l = this.padding; i < l; i++) {
out = out + ' ';
}
out = out + string + "\n";
out = out + string + '\n';
return out;
};
PrintVisitor.prototype.Program = function(program) {
PrintVisitor.prototype.Program = function (program) {
var out = '',
body = program.body,
i, l;
i = undefined,
l = undefined;
if (program.blockParams) {
var blockParams = 'BLOCK PARAMS: [';
for(i=0, l=program.blockParams.length; i<l; i++) {
blockParams += ' ' + program.blockParams[i];
for (i = 0, l = program.blockParams.length; i < l; i++) {
blockParams += ' ' + program.blockParams[i];
}

@@ -40,3 +51,3 @@ blockParams += ' ]';

for(i=0, l=body.length; i<l; i++) {
for (i = 0, l = body.length; i < l; i++) {
out = out + this.accept(body[i]);

@@ -50,8 +61,8 @@ }

PrintVisitor.prototype.MustacheStatement = function(mustache) {
PrintVisitor.prototype.MustacheStatement = function (mustache) {
return this.pad('{{ ' + this.SubExpression(mustache) + ' }}');
};
PrintVisitor.prototype.BlockStatement = function(block) {
var out = "";
PrintVisitor.prototype.BlockStatement = function (block) {
var out = '';

@@ -68,3 +79,5 @@ out = out + this.pad('BLOCK:');

if (block.inverse) {
if (block.program) { this.padding++; }
if (block.program) {
this.padding++;
}
out = out + this.pad('{{^}}');

@@ -74,3 +87,5 @@ this.padding++;

this.padding--;
if (block.program) { this.padding--; }
if (block.program) {
this.padding--;
}
}

@@ -82,5 +97,5 @@ this.padding--;

PrintVisitor.prototype.PartialStatement = function(partial) {
PrintVisitor.prototype.PartialStatement = function (partial) {
var content = 'PARTIAL:' + partial.name.original;
if(partial.params[0]) {
if (partial.params[0]) {
content += ' ' + this.accept(partial.params[0]);

@@ -94,25 +109,27 @@ }

PrintVisitor.prototype.ContentStatement = function(content) {
return this.pad("CONTENT[ '" + content.value + "' ]");
PrintVisitor.prototype.ContentStatement = function (content) {
return this.pad('CONTENT[ \'' + content.value + '\' ]');
};
PrintVisitor.prototype.CommentStatement = function(comment) {
return this.pad("{{! '" + comment.value + "' }}");
PrintVisitor.prototype.CommentStatement = function (comment) {
return this.pad('{{! \'' + comment.value + '\' }}');
};
PrintVisitor.prototype.SubExpression = function(sexpr) {
var params = sexpr.params, paramStrings = [], hash;
PrintVisitor.prototype.SubExpression = function (sexpr) {
var params = sexpr.params,
paramStrings = [],
hash = undefined;
for(var i=0, l=params.length; i<l; i++) {
for (var i = 0, l = params.length; i < l; i++) {
paramStrings.push(this.accept(params[i]));
}
params = "[" + paramStrings.join(", ") + "]";
params = '[' + paramStrings.join(', ') + ']';
hash = sexpr.hash ? " " + this.accept(sexpr.hash) : "";
hash = sexpr.hash ? ' ' + this.accept(sexpr.hash) : '';
return this.accept(sexpr.path) + " " + params + hash;
return this.accept(sexpr.path) + ' ' + params + hash;
};
PrintVisitor.prototype.PathExpression = function(id) {
PrintVisitor.prototype.PathExpression = function (id) {
var path = id.parts.join('/');

@@ -122,20 +139,27 @@ return (id.data ? '@' : '') + 'PATH:' + path;

PrintVisitor.prototype.StringLiteral = function(string) {
PrintVisitor.prototype.StringLiteral = function (string) {
return '"' + string.value + '"';
};
PrintVisitor.prototype.NumberLiteral = function(number) {
return "NUMBER{" + number.value + "}";
PrintVisitor.prototype.NumberLiteral = function (number) {
return 'NUMBER{' + number.value + '}';
};
PrintVisitor.prototype.BooleanLiteral = function(bool) {
return "BOOLEAN{" + bool.value + "}";
PrintVisitor.prototype.BooleanLiteral = function (bool) {
return 'BOOLEAN{' + bool.value + '}';
};
PrintVisitor.prototype.Hash = function(hash) {
var pairs = hash.pairs;
var joinedPairs = [];
PrintVisitor.prototype.UndefinedLiteral = function () {
return 'UNDEFINED';
};
for (var i=0, l=pairs.length; i<l; i++) {
PrintVisitor.prototype.NullLiteral = function () {
return 'NULL';
};
PrintVisitor.prototype.Hash = function (hash) {
var pairs = hash.pairs,
joinedPairs = [];
for (var i = 0, l = pairs.length; i < l; i++) {
joinedPairs.push(this.accept(pairs[i]));

@@ -146,4 +170,5 @@ }

};
PrintVisitor.prototype.HashPair = function(pair) {
PrintVisitor.prototype.HashPair = function (pair) {
return pair.key + '=' + this.accept(pair.value);
};
};
/*eslint-enable new-cap */

@@ -1,5 +0,15 @@

"use strict";
var Exception = require("../exception")["default"];
var AST = require("./ast")["default"];
'use strict';
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };
exports.__esModule = true;
var _Exception = require('../exception');
var _Exception2 = _interopRequireWildcard(_Exception);
var _AST = require('./ast');
var _AST2 = _interopRequireWildcard(_AST);
function Visitor() {

@@ -14,8 +24,8 @@ this.parents = [];

// Visits a given value. If mutating, will replace the value if necessary.
acceptKey: function(node, name) {
acceptKey: function acceptKey(node, name) {
var value = this.accept(node[name]);
if (this.mutating) {
// Hacky sanity check:
if (value && (!value.type || !AST[value.type])) {
throw new Exception('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type);
if (value && (!value.type || !_AST2['default'][value.type])) {
throw new _Exception2['default']('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type);
}

@@ -28,7 +38,7 @@ node[name] = value;

// required keys are not removed.
acceptRequired: function(node, name) {
acceptRequired: function acceptRequired(node, name) {
this.acceptKey(node, name);
if (!node[name]) {
throw new Exception(node.type + ' requires ' + name);
throw new _Exception2['default'](node.type + ' requires ' + name);
}

@@ -39,3 +49,3 @@ },

// for child elements.
acceptArray: function(array) {
acceptArray: function acceptArray(array) {
for (var i = 0, l = array.length; i < l; i++) {

@@ -52,3 +62,3 @@ this.acceptKey(array, i);

accept: function(object) {
accept: function accept(object) {
if (!object) {

@@ -74,7 +84,7 @@ return;

Program: function(program) {
Program: function Program(program) {
this.acceptArray(program.body);
},
MustacheStatement: function(mustache) {
MustacheStatement: function MustacheStatement(mustache) {
this.acceptRequired(mustache, 'path');

@@ -85,3 +95,3 @@ this.acceptArray(mustache.params);

BlockStatement: function(block) {
BlockStatement: function BlockStatement(block) {
this.acceptRequired(block, 'path');

@@ -95,3 +105,3 @@ this.acceptArray(block.params);

PartialStatement: function(partial) {
PartialStatement: function PartialStatement(partial) {
this.acceptRequired(partial, 'name');

@@ -102,6 +112,6 @@ this.acceptArray(partial.params);

ContentStatement: function(/* content */) {},
CommentStatement: function(/* comment */) {},
ContentStatement: function ContentStatement() {},
CommentStatement: function CommentStatement() {},
SubExpression: function(sexpr) {
SubExpression: function SubExpression(sexpr) {
this.acceptRequired(sexpr, 'path');

@@ -111,18 +121,15 @@ this.acceptArray(sexpr.params);

},
PartialExpression: function(partial) {
this.acceptRequired(partial, 'name');
this.acceptArray(partial.params);
this.acceptKey(partial, 'hash');
},
PathExpression: function(/* path */) {},
PathExpression: function PathExpression() {},
StringLiteral: function(/* string */) {},
NumberLiteral: function(/* number */) {},
BooleanLiteral: function(/* bool */) {},
StringLiteral: function StringLiteral() {},
NumberLiteral: function NumberLiteral() {},
BooleanLiteral: function BooleanLiteral() {},
UndefinedLiteral: function UndefinedLiteral() {},
NullLiteral: function NullLiteral() {},
Hash: function(hash) {
Hash: function Hash(hash) {
this.acceptArray(hash.pairs);
},
HashPair: function(pair) {
HashPair: function HashPair(pair) {
this.acceptRequired(pair, 'value');

@@ -132,2 +139,4 @@ }

exports["default"] = Visitor;
exports['default'] = Visitor;
module.exports = exports['default'];
/* content */ /* comment */ /* path */ /* string */ /* number */ /* bool */ /* literal */ /* literal */

@@ -1,9 +0,15 @@

"use strict";
var Visitor = require("./visitor")["default"];
'use strict';
function WhitespaceControl() {
}
WhitespaceControl.prototype = new Visitor();
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };
WhitespaceControl.prototype.Program = function(program) {
exports.__esModule = true;
var _Visitor = require('./visitor');
var _Visitor2 = _interopRequireWildcard(_Visitor);
function WhitespaceControl() {}
WhitespaceControl.prototype = new _Visitor2['default']();
WhitespaceControl.prototype.Program = function (program) {
var isRoot = !this.isRootSeen;

@@ -23,3 +29,2 @@ this.isRootSeen = true;

_isNextWhitespace = isNextWhitespace(body, i, isRoot),
openStandalone = strip.openStandalone && _isPrevWhitespace,

@@ -43,3 +48,3 @@ closeStandalone = strip.closeStandalone && _isNextWhitespace,

// Pull out the whitespace from the final line
current.indent = (/([ \t]+$)/).exec(body[i-1].original)[1];
current.indent = /([ \t]+$)/.exec(body[i - 1].original)[1];
}

@@ -64,3 +69,3 @@ }

};
WhitespaceControl.prototype.BlockStatement = function(block) {
WhitespaceControl.prototype.BlockStatement = function (block) {
this.accept(block.program);

@@ -80,3 +85,3 @@ this.accept(block.inverse);

while (lastInverse.chained) {
lastInverse = lastInverse.body[lastInverse.body.length-1].program;
lastInverse = lastInverse.body[lastInverse.body.length - 1].program;
}

@@ -114,12 +119,8 @@ }

// Find standalone else statments
if (isPrevWhitespace(program.body)
&& isNextWhitespace(firstInverse.body)) {
if (isPrevWhitespace(program.body) && isNextWhitespace(firstInverse.body)) {
omitLeft(program.body);
omitRight(firstInverse.body);
}
} else {
if (block.closeStrip.open) {
omitLeft(program.body, null, true);
}
} else if (block.closeStrip.open) {
omitLeft(program.body, null, true);
}

@@ -130,8 +131,7 @@

WhitespaceControl.prototype.MustacheStatement = function(mustache) {
WhitespaceControl.prototype.MustacheStatement = function (mustache) {
return mustache.strip;
};
WhitespaceControl.prototype.PartialStatement =
WhitespaceControl.prototype.CommentStatement = function(node) {
WhitespaceControl.prototype.PartialStatement = WhitespaceControl.prototype.CommentStatement = function (node) {
/* istanbul ignore next */

@@ -146,3 +146,2 @@ var strip = node.strip || {};

function isPrevWhitespace(body, i, isRoot) {

@@ -155,4 +154,4 @@ if (i === undefined) {

// cased for strip operations)
var prev = body[i-1],
sibling = body[i-2];
var prev = body[i - 1],
sibling = body[i - 2];
if (!prev) {

@@ -163,3 +162,3 @@ return isRoot;

if (prev.type === 'ContentStatement') {
return (sibling || !isRoot ? (/\r?\n\s*?$/) : (/(^|\r?\n)\s*?$/)).test(prev.original);
return (sibling || !isRoot ? /\r?\n\s*?$/ : /(^|\r?\n)\s*?$/).test(prev.original);
}

@@ -172,4 +171,4 @@ }

var next = body[i+1],
sibling = body[i+2];
var next = body[i + 1],
sibling = body[i + 2];
if (!next) {

@@ -180,3 +179,3 @@ return isRoot;

if (next.type === 'ContentStatement') {
return (sibling || !isRoot ? (/^\s*?\r?\n/) : (/^\s*?(\r?\n|$)/)).test(next.original);
return (sibling || !isRoot ? /^\s*?\r?\n/ : /^\s*?(\r?\n|$)/).test(next.original);
}

@@ -194,3 +193,3 @@ }

var current = body[i == null ? 0 : i + 1];
if (!current || current.type !== 'ContentStatement' || (!multiple && current.rightStripped)) {
if (!current || current.type !== 'ContentStatement' || !multiple && current.rightStripped) {
return;

@@ -200,3 +199,3 @@ }

var original = current.value;
current.value = current.value.replace(multiple ? (/^\s+/) : (/^[ \t]*\r?\n?/), '');
current.value = current.value.replace(multiple ? /^\s+/ : /^[ \t]*\r?\n?/, '');
current.rightStripped = current.value !== original;

@@ -214,3 +213,3 @@ }

var current = body[i == null ? body.length - 1 : i - 1];
if (!current || current.type !== 'ContentStatement' || (!multiple && current.leftStripped)) {
if (!current || current.type !== 'ContentStatement' || !multiple && current.leftStripped) {
return;

@@ -221,3 +220,3 @@ }

var original = current.value;
current.value = current.value.replace(multiple ? (/\s+$/) : (/[ \t]+$/), '');
current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, '');
current.leftStripped = current.value !== original;

@@ -227,2 +226,3 @@ return current.leftStripped;

exports["default"] = WhitespaceControl;
exports['default'] = WhitespaceControl;
module.exports = exports['default'];

@@ -1,3 +0,5 @@

"use strict";
'use strict';
exports.__esModule = true;
var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];

@@ -7,4 +9,4 @@

var loc = node && node.loc,
line,
column;
line = undefined,
column = undefined;
if (loc) {

@@ -24,2 +26,6 @@ line = loc.start.line;

if (Error.captureStackTrace) {
Error.captureStackTrace(this, Exception);
}
if (loc) {

@@ -33,2 +39,3 @@ this.lineNumber = line;

exports["default"] = Exception;
exports['default'] = Exception;
module.exports = exports['default'];

@@ -1,22 +0,38 @@

"use strict";
var Utils = require("./utils");
var Exception = require("./exception")["default"];
var COMPILER_REVISION = require("./base").COMPILER_REVISION;
var REVISION_CHANGES = require("./base").REVISION_CHANGES;
var createFrame = require("./base").createFrame;
'use strict';
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };
exports.__esModule = true;
exports.checkRevision = checkRevision;
// TODO: Remove this line and break up compilePartial
exports.template = template;
exports.wrapProgram = wrapProgram;
exports.resolvePartial = resolvePartial;
exports.invokePartial = invokePartial;
exports.noop = noop;
var _import = require('./utils');
var Utils = _interopRequireWildcard(_import);
var _Exception = require('./exception');
var _Exception2 = _interopRequireWildcard(_Exception);
var _COMPILER_REVISION$REVISION_CHANGES$createFrame = require('./base');
function checkRevision(compilerInfo) {
var compilerRevision = compilerInfo && compilerInfo[0] || 1,
currentRevision = COMPILER_REVISION;
currentRevision = _COMPILER_REVISION$REVISION_CHANGES$createFrame.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+").");
var runtimeVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[currentRevision],
compilerVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[compilerRevision];
throw new _Exception2['default']('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]+").");
throw new _Exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').');
}

@@ -26,11 +42,9 @@ }

exports.checkRevision = checkRevision;// TODO: Remove this line and break up compilePartial
function template(templateSpec, env) {
/* istanbul ignore next */
if (!env) {
throw new Exception("No environment passed to template");
throw new _Exception2['default']('No environment passed to template');
}
if (!templateSpec || !templateSpec.main) {
throw new Exception('Unknown template object: ' + typeof templateSpec);
throw new _Exception2['default']('Unknown template object: ' + typeof templateSpec);
}

@@ -42,3 +56,3 @@

var invokePartialWrapper = function(partial, context, options) {
function invokePartialWrapper(partial, context, options) {
if (options.hash) {

@@ -69,15 +83,15 @@ context = Utils.extend({}, context, options.hash);

} else {
throw new Exception("The partial " + options.name + " could not be compiled when running in runtime-only mode");
throw new _Exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode');
}
};
}
// Just add water
var container = {
strict: function(obj, name) {
strict: function strict(obj, name) {
if (!(name in obj)) {
throw new Exception('"' + name + '" not defined in ' + obj);
throw new _Exception2['default']('"' + name + '" not defined in ' + obj);
}
return obj[name];
},
lookup: function(depths, name) {
lookup: function lookup(depths, name) {
var len = depths.length;

@@ -90,3 +104,3 @@ for (var i = 0; i < len; i++) {

},
lambda: function(current, context) {
lambda: function lambda(current, context) {
return typeof current === 'function' ? current.call(context) : current;

@@ -98,3 +112,3 @@ },

fn: function(i) {
fn: function fn(i) {
return templateSpec[i];

@@ -104,9 +118,9 @@ },

programs: [],
program: function(i, data, declaredBlockParams, blockParams, depths) {
program: function program(i, data, declaredBlockParams, blockParams, depths) {
var programWrapper = this.programs[i],
fn = this.fn(i);
if (data || depths || blockParams || declaredBlockParams) {
programWrapper = program(this, i, fn, data, declaredBlockParams, blockParams, depths);
programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths);
} else if (!programWrapper) {
programWrapper = this.programs[i] = program(this, i, fn);
programWrapper = this.programs[i] = wrapProgram(this, i, fn);
}

@@ -116,16 +130,16 @@ return programWrapper;

data: function(data, depth) {
while (data && depth--) {
data = data._parent;
data: function data(value, depth) {
while (value && depth--) {
value = value._parent;
}
return data;
return value;
},
merge: function(param, common) {
var ret = param || common;
merge: function merge(param, common) {
var obj = param || common;
if (param && common && (param !== common)) {
ret = Utils.extend({}, common, param);
if (param && common && param !== common) {
obj = Utils.extend({}, common, param);
}
return ret;
return obj;
},

@@ -137,4 +151,5 @@

var ret = function(context, options) {
options = options || {};
function ret(context) {
var options = arguments[1] === undefined ? {} : arguments[1];
var data = options.data;

@@ -146,3 +161,3 @@

}
var depths,
var depths = undefined,
blockParams = templateSpec.useBlockParams ? [] : undefined;

@@ -154,6 +169,6 @@ if (templateSpec.useDepths) {

return templateSpec.main.call(container, context, container.helpers, container.partials, data, blockParams, depths);
};
}
ret.isTop = true;
ret._setup = function(options) {
ret._setup = function (options) {
if (!options.partial) {

@@ -171,11 +186,11 @@ container.helpers = container.merge(options.helpers, env.helpers);

ret._child = function(i, data, blockParams, depths) {
ret._child = function (i, data, blockParams, depths) {
if (templateSpec.useBlockParams && !blockParams) {
throw new Exception('must pass block params');
throw new _Exception2['default']('must pass block params');
}
if (templateSpec.useDepths && !depths) {
throw new Exception('must pass parent depths');
throw new _Exception2['default']('must pass parent depths');
}
return program(container, i, templateSpec[i], data, 0, blockParams, depths);
return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths);
};

@@ -185,13 +200,8 @@ return ret;

exports.template = template;function program(container, i, fn, data, declaredBlockParams, blockParams, depths) {
var prog = function(context, options) {
options = options || {};
function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) {
function prog(context) {
var options = arguments[1] === undefined ? {} : arguments[1];
return fn.call(container,
context,
container.helpers, container.partials,
options.data || data,
blockParams && [options.blockParams].concat(blockParams),
depths && [context].concat(depths));
};
return fn.call(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), depths && [context].concat(depths));
}
prog.program = i;

@@ -203,3 +213,3 @@ prog.depth = depths ? depths.length : 0;

exports.program = program;function resolvePartial(partial, context, options) {
function resolvePartial(partial, context, options) {
if (!partial) {

@@ -215,8 +225,8 @@ partial = options.partials[options.name];

exports.resolvePartial = resolvePartial;function invokePartial(partial, context, options) {
function invokePartial(partial, context, options) {
options.partial = true;
if(partial === undefined) {
throw new Exception("The partial " + options.name + " could not be found");
} else if(partial instanceof Function) {
if (partial === undefined) {
throw new _Exception2['default']('The partial ' + options.name + ' could not be found');
} else if (partial instanceof Function) {
return partial(context, options);

@@ -226,7 +236,9 @@ }

exports.invokePartial = invokePartial;function noop() { return ""; }
function noop() {
return '';
}
exports.noop = noop;function initData(context, data) {
function initData(context, data) {
if (!data || !('root' in data)) {
data = data ? createFrame(data) : {};
data = data ? _COMPILER_REVISION$REVISION_CHANGES$createFrame.createFrame(data) : {};
data.root = context;

@@ -233,0 +245,0 @@ }

@@ -1,2 +0,4 @@

"use strict";
'use strict';
exports.__esModule = true;
// Build out our basic SafeString type

@@ -7,6 +9,7 @@ function SafeString(string) {

SafeString.prototype.toString = SafeString.prototype.toHTML = function() {
return "" + this.string;
SafeString.prototype.toString = SafeString.prototype.toHTML = function () {
return '' + this.string;
};
exports["default"] = SafeString;
exports['default'] = SafeString;
module.exports = exports['default'];

@@ -1,14 +0,24 @@

"use strict";
'use strict';
exports.__esModule = true;
exports.extend = extend;
// Older IE versions do not directly support indexOf so we must implement our own, sadly.
exports.indexOf = indexOf;
exports.escapeExpression = escapeExpression;
exports.isEmpty = isEmpty;
exports.blockParams = blockParams;
exports.appendContextPath = appendContextPath;
/*jshint -W004 */
var escape = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#x27;",
"`": "&#x60;"
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
'\'': '&#x27;',
'`': '&#x60;'
};
var badChars = /[&<>"'`]/g;
var possible = /[&<>"'`]/;
var badChars = /[&<>"'`]/g,
possible = /[&<>"'`]/;

@@ -31,7 +41,9 @@ function escapeChar(chr) {

exports.extend = extend;var toString = Object.prototype.toString;
var toString = Object.prototype.toString;
exports.toString = toString;
// Sourced from lodash
// https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
var isFunction = function(value) {
/*eslint-disable func-style, no-var */
var isFunction = function isFunction(value) {
return typeof value === 'function';

@@ -42,3 +54,3 @@ };

if (isFunction(/x/)) {
isFunction = function(value) {
exports.isFunction = isFunction = function (value) {
return typeof value === 'function' && toString.call(value) === '[object Function]';

@@ -49,8 +61,9 @@ };

exports.isFunction = isFunction;
/*eslint-enable func-style, no-var */
/* istanbul ignore next */
var isArray = Array.isArray || function(value) {
return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false;
};
exports.isArray = isArray;
// Older IE versions do not directly support indexOf so we must implement our own, sadly.
var isArray = Array.isArray || function (value) {
return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false;
};exports.isArray = isArray;
function indexOf(array, value) {

@@ -65,3 +78,2 @@ for (var i = 0, len = array.length; i < len; i++) {

exports.indexOf = indexOf;
function escapeExpression(string) {

@@ -84,7 +96,9 @@ if (typeof string !== 'string') {

if (!possible.test(string)) { return string; }
if (!possible.test(string)) {
return string;
}
return string.replace(badChars, escapeChar);
}
exports.escapeExpression = escapeExpression;function isEmpty(value) {
function isEmpty(value) {
if (!value && value !== 0) {

@@ -99,3 +113,3 @@ return true;

exports.isEmpty = isEmpty;function blockParams(params, ids) {
function blockParams(params, ids) {
params.path = ids;

@@ -105,6 +119,4 @@ return params;

exports.blockParams = blockParams;function appendContextPath(contextPath, id) {
function appendContextPath(contextPath, id) {
return (contextPath ? contextPath + '.' : '') + id;
}
exports.appendContextPath = appendContextPath;
}

@@ -1,12 +0,24 @@

"use strict";
'use strict';
var fs = require('fs'),
Handlebars = require('./index'),
basename = require('path').basename,
SourceMap = require('source-map'),
SourceMapConsumer = SourceMap.SourceMapConsumer,
SourceNode = SourceMap.SourceNode,
uglify = require('uglify-js');
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };
module.exports.cli = function(opts) {
/*eslint-disable no-console */
var _fs = require('fs');
var _fs2 = _interopRequireWildcard(_fs);
var _import = require('./handlebars');
var Handlebars = _interopRequireWildcard(_import);
var _basename = require('path');
var _SourceMapConsumer$SourceNode = require('source-map');
var _uglify = require('uglify-js');
var _uglify2 = _interopRequireWildcard(_uglify);
module.exports.cli = function (opts) {
if (opts.version) {

@@ -21,5 +33,5 @@ console.log(Handlebars.VERSION);

opts.templates.forEach(function(template) {
opts.templates.forEach(function (template) {
try {
fs.statSync(template);
_fs2['default'].statSync(template);
} catch (err) {

@@ -33,3 +45,3 @@ throw new Handlebars.Exception('Unable to open template file "' + template + '"');

}
if (opts.simple && (opts.templates.length !== 1 || fs.statSync(opts.templates[0]).isDirectory())) {
if (opts.simple && (opts.templates.length !== 1 || _fs2['default'].statSync(opts.templates[0]).isDirectory())) {
throw new Handlebars.Exception('Unable to output multiple templates in simple mode');

@@ -50,6 +62,8 @@ }

// Build file extension pattern
var extension = opts.extension.replace(/[\\^$*+?.():=!|{}\-\[\]]/g, function(arg) { return '\\' + arg; });
var extension = opts.extension.replace(/[\\^$*+?.():=!|{}\-\[\]]/g, function (arg) {
return '\\' + arg;
});
extension = new RegExp('\\.' + extension + '$');
var output = new SourceNode();
var output = new _SourceMapConsumer$SourceNode.SourceNode();
if (!opts.simple) {

@@ -74,15 +88,15 @@ if (opts.amd) {

var path = template,
stat = fs.statSync(path);
stat = _fs2['default'].statSync(path);
if (stat.isDirectory()) {
fs.readdirSync(template).map(function(file) {
var path = template + '/' + file;
_fs2['default'].readdirSync(template).map(function (file) {
var childPath = template + '/' + file;
if (extension.test(path) || fs.statSync(path).isDirectory()) {
processTemplate(path, root || template);
if (extension.test(childPath) || _fs2['default'].statSync(childPath).isDirectory()) {
processTemplate(childPath, root || template);
}
});
} else {
var data = fs.readFileSync(path, 'utf8');
var data = _fs2['default'].readFileSync(path, 'utf8');
if (opts.bom && data.indexOf('\uFEFF') === 0) {
if (opts.bom && data.indexOf('') === 0) {
data = data.substring(1);

@@ -105,5 +119,5 @@ }

if (!root) {
template = basename(template);
template = _basename.basename(template);
} else if (template.indexOf(root) === 0) {
template = template.substring(root.length+1);
template = template.substring(root.length + 1);
}

@@ -116,4 +130,4 @@ template = template.replace(extension, '');

if (opts.map) {
var consumer = new SourceMapConsumer(precompiled.map);
precompiled = SourceNode.fromStringWithSourceMap(precompiled.code, consumer);
var consumer = new _SourceMapConsumer$SourceNode.SourceMapConsumer(precompiled.map);
precompiled = _SourceMapConsumer$SourceNode.SourceNode.fromStringWithSourceMap(precompiled.code, consumer);
}

@@ -124,3 +138,3 @@

} else if (opts.partial) {
if(opts.amd && (opts.templates.length == 1 && !fs.statSync(opts.templates[0]).isDirectory())) {
if (opts.amd && (opts.templates.length == 1 && !_fs2['default'].statSync(opts.templates[0]).isDirectory())) {
output.add('return ');

@@ -130,3 +144,3 @@ }

} else {
if(opts.amd && (opts.templates.length == 1 && !fs.statSync(opts.templates[0]).isDirectory())) {
if (opts.amd && (opts.templates.length == 1 && !_fs2['default'].statSync(opts.templates[0]).isDirectory())) {
output.add('return ');

@@ -139,3 +153,3 @@ }

opts.templates.forEach(function(template) {
opts.templates.forEach(function (template) {
processTemplate(template, opts.root);

@@ -147,4 +161,4 @@ });

if (opts.amd) {
if(opts.templates.length > 1 || (opts.templates.length == 1 && fs.statSync(opts.templates[0]).isDirectory())) {
if(opts.partial){
if (opts.templates.length > 1 || opts.templates.length == 1 && _fs2['default'].statSync(opts.templates[0]).isDirectory()) {
if (opts.partial) {
output.add('return Handlebars.partials;\n');

@@ -161,3 +175,2 @@ } else {

if (opts.map) {

@@ -171,3 +184,3 @@ output.add('\n//# sourceMappingURL=' + opts.map + '\n');

if (opts.min) {
output = uglify.minify(output.code, {
output = _uglify2['default'].minify(output.code, {
fromString: true,

@@ -184,3 +197,3 @@

if (opts.map) {
fs.writeFileSync(opts.map, output.map, 'utf8');
_fs2['default'].writeFileSync(opts.map, output.map, 'utf8');
}

@@ -190,3 +203,3 @@ output = output.code;

if (opts.output) {
fs.writeFileSync(opts.output, output, 'utf8');
_fs2['default'].writeFileSync(opts.output, output, 'utf8');
} else {

@@ -193,0 +206,0 @@ console.log(output);

/*!
handlebars v3.0.1
handlebars v3.0.2

@@ -27,679 +27,712 @@ Copyright (C) 2011-2014 by Yehuda Katz

*/
define(
'handlebars/utils',["exports"],
function(__exports__) {
/*jshint -W004 */
var escape = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#x27;",
"`": "&#x60;"
};
define('handlebars/utils',['exports'], function (exports) {
var badChars = /[&<>"'`]/g;
var possible = /[&<>"'`]/;
exports.__esModule = true;
exports.extend = extend;
function escapeChar(chr) {
return escape[chr];
}
// Older IE versions do not directly support indexOf so we must implement our own, sadly.
exports.indexOf = indexOf;
exports.escapeExpression = escapeExpression;
exports.isEmpty = isEmpty;
exports.blockParams = blockParams;
exports.appendContextPath = appendContextPath;
/*jshint -W004 */
var escape = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
'\'': '&#x27;',
'`': '&#x60;'
};
function extend(obj /* , ...source */) {
for (var i = 1; i < arguments.length; i++) {
for (var key in arguments[i]) {
if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
obj[key] = arguments[i][key];
}
}
}
var badChars = /[&<>"'`]/g,
possible = /[&<>"'`]/;
return obj;
}
function escapeChar(chr) {
return escape[chr];
}
__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
/* istanbul ignore next */
if (isFunction(/x/)) {
isFunction = function(value) {
return typeof value === 'function' && toString.call(value) === '[object Function]';
};
}
var isFunction;
__exports__.isFunction = isFunction;
/* istanbul ignore next */
var isArray = Array.isArray || function(value) {
return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false;
};
__exports__.isArray = isArray;
// Older IE versions do not directly support indexOf so we must implement our own, sadly.
function indexOf(array, value) {
for (var i = 0, len = array.length; i < len; i++) {
if (array[i] === value) {
return i;
function extend(obj /* , ...source */) {
for (var i = 1; i < arguments.length; i++) {
for (var key in arguments[i]) {
if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
obj[key] = arguments[i][key];
}
}
return -1;
}
__exports__.indexOf = indexOf;
function escapeExpression(string) {
if (typeof string !== 'string') {
// don't escape SafeStrings, since they're already safe
if (string && string.toHTML) {
return string.toHTML();
} else if (string == null) {
return '';
} else if (!string) {
return string + '';
}
return obj;
}
// 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;
var toString = Object.prototype.toString;
exports.toString = toString;
// Sourced from lodash
// https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
/*eslint-disable func-style, no-var */
var isFunction = function isFunction(value) {
return typeof value === 'function';
};
// fallback for older versions of Chrome and Safari
/* istanbul ignore next */
if (isFunction(/x/)) {
exports.isFunction = isFunction = function (value) {
return typeof value === 'function' && toString.call(value) === '[object Function]';
};
}
var isFunction;
exports.isFunction = isFunction;
/*eslint-enable func-style, no-var */
/* istanbul ignore next */
var isArray = Array.isArray || function (value) {
return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false;
};exports.isArray = isArray;
function indexOf(array, value) {
for (var i = 0, len = array.length; i < len; i++) {
if (array[i] === value) {
return i;
}
if (!possible.test(string)) { return string; }
return string.replace(badChars, escapeChar);
}
return -1;
}
__exports__.escapeExpression = escapeExpression;function isEmpty(value) {
if (!value && value !== 0) {
return true;
} else if (isArray(value) && value.length === 0) {
return true;
} else {
return false;
function escapeExpression(string) {
if (typeof string !== 'string') {
// don't escape SafeStrings, since they're already safe
if (string && string.toHTML) {
return string.toHTML();
} else if (string == null) {
return '';
} else if (!string) {
return string + '';
}
// 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;
}
__exports__.isEmpty = isEmpty;function blockParams(params, ids) {
params.path = ids;
return params;
if (!possible.test(string)) {
return string;
}
return string.replace(badChars, escapeChar);
}
__exports__.blockParams = blockParams;function appendContextPath(contextPath, id) {
return (contextPath ? contextPath + '.' : '') + id;
function isEmpty(value) {
if (!value && value !== 0) {
return true;
} else if (isArray(value) && value.length === 0) {
return true;
} else {
return false;
}
}
__exports__.appendContextPath = appendContextPath;
});
define(
'handlebars/exception',["exports"],
function(__exports__) {
function blockParams(params, ids) {
params.path = ids;
return params;
}
var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
function appendContextPath(contextPath, id) {
return (contextPath ? contextPath + '.' : '') + id;
}
});
define('handlebars/exception',['exports', 'module'], function (exports, module) {
function Exception(message, node) {
var loc = node && node.loc,
line,
column;
if (loc) {
line = loc.start.line;
column = loc.start.column;
var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
message += ' - ' + line + ':' + column;
}
function Exception(message, node) {
var loc = node && node.loc,
line = undefined,
column = undefined;
if (loc) {
line = loc.start.line;
column = loc.start.column;
var tmp = Error.prototype.constructor.call(this, message);
message += ' - ' + line + ':' + column;
}
// 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]];
}
var tmp = Error.prototype.constructor.call(this, message);
if (loc) {
this.lineNumber = line;
this.column = column;
}
// 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]];
}
Exception.prototype = new Error();
if (Error.captureStackTrace) {
Error.captureStackTrace(this, Exception);
}
__exports__["default"] = Exception;
});
define(
'handlebars/base',["./utils","./exception","exports"],
function(__dependency1__, __dependency2__, __exports__) {
var Utils = __dependency1__;
var Exception = __dependency2__["default"];
if (loc) {
this.lineNumber = line;
this.column = column;
}
}
var VERSION = "3.0.1";
__exports__.VERSION = VERSION;var COMPILER_REVISION = 6;
__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.x.x',
5: '== 2.0.0-alpha.x',
6: '>= 2.0.0-beta.1'
};
__exports__.REVISION_CHANGES = REVISION_CHANGES;
var isArray = Utils.isArray,
isFunction = Utils.isFunction,
toString = Utils.toString,
objectType = '[object Object]';
Exception.prototype = new Error();
function HandlebarsEnvironment(helpers, partials) {
this.helpers = helpers || {};
this.partials = partials || {};
module.exports = Exception;
});
define('handlebars/base',['exports', './utils', './exception'], function (exports, _utils, _exception) {
registerDefaultHelpers(this);
}
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj['default'] : obj; };
__exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = {
constructor: HandlebarsEnvironment,
exports.__esModule = true;
exports.HandlebarsEnvironment = HandlebarsEnvironment;
exports.createFrame = createFrame;
logger: logger,
log: log,
var _Exception = _interopRequire(_exception);
registerHelper: function(name, fn) {
if (toString.call(name) === objectType) {
if (fn) { throw new Exception('Arg not supported with multiple helpers'); }
Utils.extend(this.helpers, name);
} else {
this.helpers[name] = fn;
}
},
unregisterHelper: function(name) {
delete this.helpers[name];
},
var VERSION = '3.0.1';
exports.VERSION = VERSION;
var COMPILER_REVISION = 6;
registerPartial: function(name, partial) {
if (toString.call(name) === objectType) {
Utils.extend(this.partials, name);
} else {
if (typeof partial === 'undefined') {
throw new Exception('Attempting to register a partial as undefined');
}
this.partials[name] = partial;
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.x.x',
5: '== 2.0.0-alpha.x',
6: '>= 2.0.0-beta.1'
};
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);
}
HandlebarsEnvironment.prototype = {
constructor: HandlebarsEnvironment,
logger: logger,
log: log,
registerHelper: function registerHelper(name, fn) {
if (toString.call(name) === objectType) {
if (fn) {
throw new _Exception('Arg not supported with multiple helpers');
}
},
unregisterPartial: function(name) {
delete this.partials[name];
_utils.extend(this.helpers, name);
} else {
this.helpers[name] = fn;
}
};
},
unregisterHelper: function unregisterHelper(name) {
delete this.helpers[name];
},
function registerDefaultHelpers(instance) {
instance.registerHelper('helperMissing', function(/* [args, ]options */) {
if(arguments.length === 1) {
// A missing field in a {{foo}} constuct.
return undefined;
} else {
// Someone is actually trying to call something, blow up.
throw new Exception("Missing helper: '" + arguments[arguments.length-1].name + "'");
registerPartial: function registerPartial(name, partial) {
if (toString.call(name) === objectType) {
_utils.extend(this.partials, name);
} else {
if (typeof partial === 'undefined') {
throw new _Exception('Attempting to register a partial as undefined');
}
});
this.partials[name] = partial;
}
},
unregisterPartial: function unregisterPartial(name) {
delete this.partials[name];
}
};
instance.registerHelper('blockHelperMissing', function(context, options) {
var inverse = options.inverse,
fn = options.fn;
function registerDefaultHelpers(instance) {
instance.registerHelper('helperMissing', function () {
if (arguments.length === 1) {
// A missing field in a {{foo}} constuct.
return undefined;
} else {
// Someone is actually trying to call something, blow up.
throw new _Exception('Missing helper: "' + arguments[arguments.length - 1].name + '"');
}
});
if(context === true) {
return fn(this);
} else if(context === false || context == null) {
return inverse(this);
} else if (isArray(context)) {
if(context.length > 0) {
if (options.ids) {
options.ids = [options.name];
}
instance.registerHelper('blockHelperMissing', function (context, options) {
var inverse = options.inverse,
fn = options.fn;
return instance.helpers.each(context, options);
} else {
return inverse(this);
if (context === true) {
return fn(this);
} else if (context === false || context == null) {
return inverse(this);
} else if (isArray(context)) {
if (context.length > 0) {
if (options.ids) {
options.ids = [options.name];
}
return instance.helpers.each(context, options);
} else {
if (options.data && options.ids) {
var data = createFrame(options.data);
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name);
options = {data: data};
}
return fn(context, options);
return inverse(this);
}
});
instance.registerHelper('each', function(context, options) {
if (!options) {
throw new Exception('Must pass iterator to #each');
} else {
if (options.data && options.ids) {
var data = createFrame(options.data);
data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name);
options = { data: data };
}
var fn = options.fn, inverse = options.inverse;
var i = 0, ret = "", data;
return fn(context, options);
}
});
var contextPath;
if (options.data && options.ids) {
contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';
}
instance.registerHelper('each', function (context, options) {
if (!options) {
throw new _Exception('Must pass iterator to #each');
}
if (isFunction(context)) { context = context.call(this); }
var fn = options.fn,
inverse = options.inverse,
i = 0,
ret = '',
data = undefined,
contextPath = undefined;
if (options.data) {
data = createFrame(options.data);
}
if (options.data && options.ids) {
contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';
}
function execIteration(key, i, last) {
if (data) {
data.key = key;
data.index = i;
data.first = i === 0;
data.last = !!last;
if (isFunction(context)) {
context = context.call(this);
}
if (contextPath) {
data.contextPath = contextPath + key;
}
if (options.data) {
data = createFrame(options.data);
}
function execIteration(field, index, last) {
if (data) {
data.key = field;
data.index = index;
data.first = index === 0;
data.last = !!last;
if (contextPath) {
data.contextPath = contextPath + field;
}
ret = ret + fn(context[key], {
data: data,
blockParams: Utils.blockParams([context[key], key], [contextPath + key, null])
});
}
if(context && typeof context === 'object') {
if (isArray(context)) {
for(var j = context.length; i<j; i++) {
execIteration(i, i, i === context.length-1);
}
} else {
var priorKey;
ret = ret + fn(context[field], {
data: data,
blockParams: _utils.blockParams([context[field], field], [contextPath + field, null])
});
}
for(var key in context) {
if(context.hasOwnProperty(key)) {
// We're running the iterations one step out of sync so we can detect
// the last iteration without have to scan the object twice and create
// an itermediate keys array.
if (priorKey) {
execIteration(priorKey, i-1);
}
priorKey = key;
i++;
if (context && typeof context === 'object') {
if (isArray(context)) {
for (var j = context.length; i < j; i++) {
execIteration(i, i, i === context.length - 1);
}
} else {
var priorKey = undefined;
for (var key in context) {
if (context.hasOwnProperty(key)) {
// We're running the iterations one step out of sync so we can detect
// the last iteration without have to scan the object twice and create
// an itermediate keys array.
if (priorKey) {
execIteration(priorKey, i - 1);
}
priorKey = key;
i++;
}
if (priorKey) {
execIteration(priorKey, i-1, true);
}
}
if (priorKey) {
execIteration(priorKey, i - 1, true);
}
}
}
if(i === 0){
ret = inverse(this);
}
if (i === 0) {
ret = inverse(this);
}
return ret;
});
return ret;
});
instance.registerHelper('if', function(conditional, options) {
if (isFunction(conditional)) { conditional = conditional.call(this); }
instance.registerHelper('if', function (conditional, options) {
if (isFunction(conditional)) {
conditional = conditional.call(this);
}
// Default behavior is to render the positive path if the value is truthy and not empty.
// The `includeZero` option may be set to treat the condtional as purely not empty based on the
// behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
if ((!options.hash.includeZero && !conditional) || Utils.isEmpty(conditional)) {
return options.inverse(this);
} else {
return options.fn(this);
}
});
// Default behavior is to render the positive path if the value is truthy and not empty.
// The `includeZero` option may be set to treat the condtional as purely not empty based on the
// behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) {
return options.inverse(this);
} else {
return options.fn(this);
}
});
instance.registerHelper('unless', function(conditional, options) {
return instance.helpers['if'].call(this, conditional, {fn: options.inverse, inverse: options.fn, hash: options.hash});
});
instance.registerHelper('unless', function (conditional, options) {
return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash });
});
instance.registerHelper('with', function(context, options) {
if (isFunction(context)) { context = context.call(this); }
instance.registerHelper('with', function (context, options) {
if (isFunction(context)) {
context = context.call(this);
}
var fn = options.fn;
var fn = options.fn;
if (!Utils.isEmpty(context)) {
if (options.data && options.ids) {
var data = createFrame(options.data);
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]);
options = {data:data};
}
return fn(context, options);
} else {
return options.inverse(this);
if (!_utils.isEmpty(context)) {
if (options.data && options.ids) {
var data = createFrame(options.data);
data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]);
options = { data: data };
}
});
instance.registerHelper('log', function(message, options) {
var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
instance.log(level, message);
});
return fn(context, options);
} else {
return options.inverse(this);
}
});
instance.registerHelper('lookup', function(obj, field) {
return obj && obj[field];
});
}
instance.registerHelper('log', function (message, options) {
var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
instance.log(level, message);
});
var logger = {
methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' },
instance.registerHelper('lookup', function (obj, field) {
return obj && obj[field];
});
}
// State enum
DEBUG: 0,
INFO: 1,
WARN: 2,
ERROR: 3,
level: 1,
var logger = {
methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' },
// Can be overridden in the host environment
log: function(level, message) {
if (typeof console !== 'undefined' && logger.level <= level) {
var method = logger.methodMap[level];
(console[method] || console.log).call(console, message);
}
// State enum
DEBUG: 0,
INFO: 1,
WARN: 2,
ERROR: 3,
level: 1,
// Can be overridden in the host environment
log: function log(level, message) {
if (typeof console !== 'undefined' && logger.level <= level) {
var method = logger.methodMap[level];
(console[method] || console.log).call(console, message); // eslint-disable-line no-console
}
};
__exports__.logger = logger;
var log = logger.log;
__exports__.log = log;
var createFrame = function(object) {
var frame = Utils.extend({}, object);
frame._parent = object;
return frame;
};
__exports__.createFrame = createFrame;
});
define(
'handlebars/safe-string',["exports"],
function(__exports__) {
// Build out our basic SafeString type
function SafeString(string) {
this.string = string;
}
};
SafeString.prototype.toString = SafeString.prototype.toHTML = function() {
return "" + this.string;
};
exports.logger = logger;
var log = logger.log;
__exports__["default"] = SafeString;
});
define(
'handlebars/runtime',["./utils","./exception","./base","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
var Utils = __dependency1__;
var Exception = __dependency2__["default"];
var COMPILER_REVISION = __dependency3__.COMPILER_REVISION;
var REVISION_CHANGES = __dependency3__.REVISION_CHANGES;
var createFrame = __dependency3__.createFrame;
exports.log = log;
function checkRevision(compilerInfo) {
var compilerRevision = compilerInfo && compilerInfo[0] || 1,
currentRevision = COMPILER_REVISION;
function createFrame(object) {
var frame = _utils.extend({}, object);
frame._parent = object;
return frame;
}
});
/* [args, ]options */;
define('handlebars/safe-string',['exports', 'module'], function (exports, module) {
// Build out our basic SafeString type
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]+").");
}
}
}
function SafeString(string) {
this.string = string;
}
__exports__.checkRevision = checkRevision;// TODO: Remove this line and break up compilePartial
SafeString.prototype.toString = SafeString.prototype.toHTML = function () {
return '' + this.string;
};
function template(templateSpec, env) {
/* istanbul ignore next */
if (!env) {
throw new Exception("No environment passed to template");
module.exports = SafeString;
});
define('handlebars/runtime',['exports', './utils', './exception', './base'], function (exports, _utils, _exception, _base) {
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj['default'] : obj; };
exports.__esModule = true;
exports.checkRevision = checkRevision;
// TODO: Remove this line and break up compilePartial
exports.template = template;
exports.wrapProgram = wrapProgram;
exports.resolvePartial = resolvePartial;
exports.invokePartial = invokePartial;
exports.noop = noop;
var _Exception = _interopRequire(_exception);
function checkRevision(compilerInfo) {
var compilerRevision = compilerInfo && compilerInfo[0] || 1,
currentRevision = _base.COMPILER_REVISION;
if (compilerRevision !== currentRevision) {
if (compilerRevision < currentRevision) {
var runtimeVersions = _base.REVISION_CHANGES[currentRevision],
compilerVersions = _base.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] + ').');
}
if (!templateSpec || !templateSpec.main) {
throw new Exception('Unknown template object: ' + typeof templateSpec);
}
}
}
// 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.
env.VM.checkRevision(templateSpec.compiler);
function template(templateSpec, env) {
/* istanbul ignore next */
if (!env) {
throw new _Exception('No environment passed to template');
}
if (!templateSpec || !templateSpec.main) {
throw new _Exception('Unknown template object: ' + typeof templateSpec);
}
var invokePartialWrapper = function(partial, context, options) {
if (options.hash) {
context = Utils.extend({}, context, options.hash);
}
// 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.
env.VM.checkRevision(templateSpec.compiler);
partial = env.VM.resolvePartial.call(this, partial, context, options);
var result = env.VM.invokePartial.call(this, partial, context, options);
function invokePartialWrapper(partial, context, options) {
if (options.hash) {
context = _utils.extend({}, context, options.hash);
}
if (result == null && env.compile) {
options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env);
result = options.partials[options.name](context, options);
}
if (result != null) {
if (options.indent) {
var lines = result.split('\n');
for (var i = 0, l = lines.length; i < l; i++) {
if (!lines[i] && i + 1 === l) {
break;
}
partial = env.VM.resolvePartial.call(this, partial, context, options);
var result = env.VM.invokePartial.call(this, partial, context, options);
lines[i] = options.indent + lines[i];
if (result == null && env.compile) {
options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env);
result = options.partials[options.name](context, options);
}
if (result != null) {
if (options.indent) {
var lines = result.split('\n');
for (var i = 0, l = lines.length; i < l; i++) {
if (!lines[i] && i + 1 === l) {
break;
}
result = lines.join('\n');
lines[i] = options.indent + lines[i];
}
return result;
} else {
throw new Exception("The partial " + options.name + " could not be compiled when running in runtime-only mode");
result = lines.join('\n');
}
};
return result;
} else {
throw new _Exception('The partial ' + options.name + ' could not be compiled when running in runtime-only mode');
}
}
// Just add water
var container = {
strict: function(obj, name) {
if (!(name in obj)) {
throw new Exception('"' + name + '" not defined in ' + obj);
// Just add water
var container = {
strict: function strict(obj, name) {
if (!(name in obj)) {
throw new _Exception('"' + name + '" not defined in ' + obj);
}
return obj[name];
},
lookup: function lookup(depths, name) {
var len = depths.length;
for (var i = 0; i < len; i++) {
if (depths[i] && depths[i][name] != null) {
return depths[i][name];
}
return obj[name];
},
lookup: function(depths, name) {
var len = depths.length;
for (var i = 0; i < len; i++) {
if (depths[i] && depths[i][name] != null) {
return depths[i][name];
}
}
},
lambda: function(current, context) {
return typeof current === 'function' ? current.call(context) : current;
},
}
},
lambda: function lambda(current, context) {
return typeof current === 'function' ? current.call(context) : current;
},
escapeExpression: Utils.escapeExpression,
invokePartial: invokePartialWrapper,
escapeExpression: _utils.escapeExpression,
invokePartial: invokePartialWrapper,
fn: function(i) {
return templateSpec[i];
},
fn: function fn(i) {
return templateSpec[i];
},
programs: [],
program: function(i, data, declaredBlockParams, blockParams, depths) {
var programWrapper = this.programs[i],
fn = this.fn(i);
if (data || depths || blockParams || declaredBlockParams) {
programWrapper = program(this, i, fn, data, declaredBlockParams, blockParams, depths);
} else if (!programWrapper) {
programWrapper = this.programs[i] = program(this, i, fn);
}
return programWrapper;
},
programs: [],
program: function program(i, data, declaredBlockParams, blockParams, depths) {
var programWrapper = this.programs[i],
fn = this.fn(i);
if (data || depths || blockParams || declaredBlockParams) {
programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths);
} else if (!programWrapper) {
programWrapper = this.programs[i] = wrapProgram(this, i, fn);
}
return programWrapper;
},
data: function(data, depth) {
while (data && depth--) {
data = data._parent;
}
return data;
},
merge: function(param, common) {
var ret = param || common;
data: function data(value, depth) {
while (value && depth--) {
value = value._parent;
}
return value;
},
merge: function merge(param, common) {
var obj = param || common;
if (param && common && (param !== common)) {
ret = Utils.extend({}, common, param);
}
if (param && common && param !== common) {
obj = _utils.extend({}, common, param);
}
return ret;
},
return obj;
},
noop: env.VM.noop,
compilerInfo: templateSpec.compiler
};
noop: env.VM.noop,
compilerInfo: templateSpec.compiler
};
var ret = function(context, options) {
options = options || {};
var data = options.data;
function ret(context) {
var options = arguments[1] === undefined ? {} : arguments[1];
ret._setup(options);
if (!options.partial && templateSpec.useData) {
data = initData(context, data);
}
var depths,
blockParams = templateSpec.useBlockParams ? [] : undefined;
if (templateSpec.useDepths) {
depths = options.depths ? [context].concat(options.depths) : [context];
}
var data = options.data;
return templateSpec.main.call(container, context, container.helpers, container.partials, data, blockParams, depths);
};
ret.isTop = true;
ret._setup(options);
if (!options.partial && templateSpec.useData) {
data = initData(context, data);
}
var depths = undefined,
blockParams = templateSpec.useBlockParams ? [] : undefined;
if (templateSpec.useDepths) {
depths = options.depths ? [context].concat(options.depths) : [context];
}
ret._setup = function(options) {
if (!options.partial) {
container.helpers = container.merge(options.helpers, env.helpers);
return templateSpec.main.call(container, context, container.helpers, container.partials, data, blockParams, depths);
}
ret.isTop = true;
if (templateSpec.usePartial) {
container.partials = container.merge(options.partials, env.partials);
}
} else {
container.helpers = options.helpers;
container.partials = options.partials;
}
};
ret._setup = function (options) {
if (!options.partial) {
container.helpers = container.merge(options.helpers, env.helpers);
ret._child = function(i, data, blockParams, depths) {
if (templateSpec.useBlockParams && !blockParams) {
throw new Exception('must pass block params');
if (templateSpec.usePartial) {
container.partials = container.merge(options.partials, env.partials);
}
if (templateSpec.useDepths && !depths) {
throw new Exception('must pass parent depths');
}
} else {
container.helpers = options.helpers;
container.partials = options.partials;
}
};
return program(container, i, templateSpec[i], data, 0, blockParams, depths);
};
return ret;
}
ret._child = function (i, data, blockParams, depths) {
if (templateSpec.useBlockParams && !blockParams) {
throw new _Exception('must pass block params');
}
if (templateSpec.useDepths && !depths) {
throw new _Exception('must pass parent depths');
}
__exports__.template = template;function program(container, i, fn, data, declaredBlockParams, blockParams, depths) {
var prog = function(context, options) {
options = options || {};
return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths);
};
return ret;
}
return fn.call(container,
context,
container.helpers, container.partials,
options.data || data,
blockParams && [options.blockParams].concat(blockParams),
depths && [context].concat(depths));
};
prog.program = i;
prog.depth = depths ? depths.length : 0;
prog.blockParams = declaredBlockParams || 0;
return prog;
function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) {
function prog(context) {
var options = arguments[1] === undefined ? {} : arguments[1];
return fn.call(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), depths && [context].concat(depths));
}
prog.program = i;
prog.depth = depths ? depths.length : 0;
prog.blockParams = declaredBlockParams || 0;
return prog;
}
__exports__.program = program;function resolvePartial(partial, context, options) {
if (!partial) {
partial = options.partials[options.name];
} else if (!partial.call && !options.name) {
// This is a dynamic partial that returned a string
options.name = partial;
partial = options.partials[partial];
}
return partial;
function resolvePartial(partial, context, options) {
if (!partial) {
partial = options.partials[options.name];
} else if (!partial.call && !options.name) {
// This is a dynamic partial that returned a string
options.name = partial;
partial = options.partials[partial];
}
return partial;
}
__exports__.resolvePartial = resolvePartial;function invokePartial(partial, context, options) {
options.partial = true;
function invokePartial(partial, context, options) {
options.partial = true;
if(partial === undefined) {
throw new Exception("The partial " + options.name + " could not be found");
} else if(partial instanceof Function) {
return partial(context, options);
}
if (partial === undefined) {
throw new _Exception('The partial ' + options.name + ' could not be found');
} else if (partial instanceof Function) {
return partial(context, options);
}
}
__exports__.invokePartial = invokePartial;function noop() { return ""; }
function noop() {
return '';
}
__exports__.noop = noop;function initData(context, data) {
if (!data || !('root' in data)) {
data = data ? createFrame(data) : {};
data.root = context;
}
return data;
function initData(context, data) {
if (!data || !('root' in data)) {
data = data ? _base.createFrame(data) : {};
data.root = context;
}
});
define(
'handlebars.runtime',["./handlebars/base","./handlebars/safe-string","./handlebars/exception","./handlebars/utils","./handlebars/runtime","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __exports__) {
/*globals Handlebars: true */
var base = __dependency1__;
return data;
}
});
define('handlebars.runtime',['exports', 'module', './handlebars/base', './handlebars/safe-string', './handlebars/exception', './handlebars/utils', './handlebars/runtime'], function (exports, module, _handlebarsBase, _handlebarsSafeString, _handlebarsException, _handlebarsUtils, _handlebarsRuntime) {
// Each of these augment the Handlebars object. No need to setup here.
// (This is done to easily share code between commonjs and browse envs)
var SafeString = __dependency2__["default"];
var Exception = __dependency3__["default"];
var Utils = __dependency4__;
var runtime = __dependency5__;
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj['default'] : obj; };
// For compatibility and usage outside of module systems, make the Handlebars object a namespace
var create = function() {
var hb = new base.HandlebarsEnvironment();
// Each of these augment the Handlebars object. No need to setup here.
// (This is done to easily share code between commonjs and browse envs)
Utils.extend(hb, base);
hb.SafeString = SafeString;
hb.Exception = Exception;
hb.Utils = Utils;
hb.escapeExpression = Utils.escapeExpression;
var _SafeString = _interopRequire(_handlebarsSafeString);
hb.VM = runtime;
hb.template = function(spec) {
return runtime.template(spec, hb);
};
var _Exception = _interopRequire(_handlebarsException);
return hb;
};
// For compatibility and usage outside of module systems, make the Handlebars object a namespace
function create() {
var hb = new _handlebarsBase.HandlebarsEnvironment();
var Handlebars = create();
Handlebars.create = create;
_handlebarsUtils.extend(hb, _handlebarsBase);
hb.SafeString = _SafeString;
hb.Exception = _Exception;
hb.Utils = _handlebarsUtils;
hb.escapeExpression = _handlebarsUtils.escapeExpression;
/*jshint -W040 */
/* istanbul ignore next */
var root = typeof global !== 'undefined' ? global : window,
$Handlebars = root.Handlebars;
/* istanbul ignore next */
Handlebars.noConflict = function() {
if (root.Handlebars === Handlebars) {
root.Handlebars = $Handlebars;
}
hb.VM = _handlebarsRuntime;
hb.template = function (spec) {
return _handlebarsRuntime.template(spec, hb);
};
Handlebars['default'] = Handlebars;
return hb;
}
__exports__["default"] = Handlebars;
});
var Handlebars = create();
Handlebars.create = create;
/*jshint -W040 */
/* istanbul ignore next */
var root = typeof global !== 'undefined' ? global : window,
$Handlebars = root.Handlebars;
/* istanbul ignore next */
Handlebars.noConflict = function () {
if (root.Handlebars === Handlebars) {
root.Handlebars = $Handlebars;
}
};
Handlebars['default'] = Handlebars;
module.exports = Handlebars;
});
/*global window */;
/*!
handlebars v3.0.1
handlebars v3.0.2

@@ -27,2 +27,2 @@ Copyright (C) 2011-2014 by Yehuda Katz

*/
define("handlebars/utils",["exports"],function(a){function b(a){return i[a]}function c(a){for(var b=1;b<arguments.length;b++)for(var c in arguments[b])Object.prototype.hasOwnProperty.call(arguments[b],c)&&(a[c]=arguments[b][c]);return a}function d(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1}function e(a){if("string"!=typeof a){if(a&&a.toHTML)return a.toHTML();if(null==a)return"";if(!a)return a+"";a=""+a}return k.test(a)?a.replace(j,b):a}function f(a){return a||0===a?n(a)&&0===a.length?!0:!1:!0}function g(a,b){return a.path=b,a}function h(a,b){return(a?a+".":"")+b}var i={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},j=/[&<>"'`]/g,k=/[&<>"'`]/;a.extend=c;var l=Object.prototype.toString;a.toString=l;var m=function(a){return"function"==typeof a};m(/x/)&&(m=function(a){return"function"==typeof a&&"[object Function]"===l.call(a)});var m;a.isFunction=m;var n=Array.isArray||function(a){return a&&"object"==typeof a?"[object Array]"===l.call(a):!1};a.isArray=n,a.indexOf=d,a.escapeExpression=e,a.isEmpty=f,a.blockParams=g,a.appendContextPath=h}),define("handlebars/exception",["exports"],function(a){function b(a,b){var d,e,f=b&&b.loc;f&&(d=f.start.line,e=f.start.column,a+=" - "+d+":"+e);for(var g=Error.prototype.constructor.call(this,a),h=0;h<c.length;h++)this[c[h]]=g[c[h]];f&&(this.lineNumber=d,this.column=e)}var c=["description","fileName","lineNumber","message","name","number","stack"];b.prototype=new Error,a["default"]=b}),define("handlebars/base",["./utils","./exception","exports"],function(a,b,c){function d(a,b){this.helpers=a||{},this.partials=b||{},e(this)}function e(a){a.registerHelper("helperMissing",function(){if(1===arguments.length)return void 0;throw new g("Missing helper: '"+arguments[arguments.length-1].name+"'")}),a.registerHelper("blockHelperMissing",function(b,c){var d=c.inverse,e=c.fn;if(b===!0)return e(this);if(b===!1||null==b)return d(this);if(k(b))return b.length>0?(c.ids&&(c.ids=[c.name]),a.helpers.each(b,c)):d(this);if(c.data&&c.ids){var g=q(c.data);g.contextPath=f.appendContextPath(c.data.contextPath,c.name),c={data:g}}return e(b,c)}),a.registerHelper("each",function(a,b){function c(b,c,g){d&&(d.key=b,d.index=c,d.first=0===c,d.last=!!g,e&&(d.contextPath=e+b)),m+=h(a[b],{data:d,blockParams:f.blockParams([a[b],b],[e+b,null])})}if(!b)throw new g("Must pass iterator to #each");var d,e,h=b.fn,i=b.inverse,j=0,m="";if(b.data&&b.ids&&(e=f.appendContextPath(b.data.contextPath,b.ids[0])+"."),l(a)&&(a=a.call(this)),b.data&&(d=q(b.data)),a&&"object"==typeof a)if(k(a))for(var n=a.length;n>j;j++)c(j,j,j===a.length-1);else{var o;for(var p in a)a.hasOwnProperty(p)&&(o&&c(o,j-1),o=p,j++);o&&c(o,j-1,!0)}return 0===j&&(m=i(this)),m}),a.registerHelper("if",function(a,b){return l(a)&&(a=a.call(this)),!b.hash.includeZero&&!a||f.isEmpty(a)?b.inverse(this):b.fn(this)}),a.registerHelper("unless",function(b,c){return a.helpers["if"].call(this,b,{fn:c.inverse,inverse:c.fn,hash:c.hash})}),a.registerHelper("with",function(a,b){l(a)&&(a=a.call(this));var c=b.fn;if(f.isEmpty(a))return b.inverse(this);if(b.data&&b.ids){var d=q(b.data);d.contextPath=f.appendContextPath(b.data.contextPath,b.ids[0]),b={data:d}}return c(a,b)}),a.registerHelper("log",function(b,c){var d=c.data&&null!=c.data.level?parseInt(c.data.level,10):1;a.log(d,b)}),a.registerHelper("lookup",function(a,b){return a&&a[b]})}var f=a,g=b["default"],h="3.0.1";c.VERSION=h;var i=6;c.COMPILER_REVISION=i;var j={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1"};c.REVISION_CHANGES=j;var k=f.isArray,l=f.isFunction,m=f.toString,n="[object Object]";c.HandlebarsEnvironment=d,d.prototype={constructor:d,logger:o,log:p,registerHelper:function(a,b){if(m.call(a)===n){if(b)throw new g("Arg not supported with multiple helpers");f.extend(this.helpers,a)}else this.helpers[a]=b},unregisterHelper:function(a){delete this.helpers[a]},registerPartial:function(a,b){if(m.call(a)===n)f.extend(this.partials,a);else{if("undefined"==typeof b)throw new g("Attempting to register a partial as undefined");this.partials[a]=b}},unregisterPartial:function(a){delete this.partials[a]}};var o={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:1,log:function(a,b){if("undefined"!=typeof console&&o.level<=a){var c=o.methodMap[a];(console[c]||console.log).call(console,b)}}};c.logger=o;var p=o.log;c.log=p;var q=function(a){var b=f.extend({},a);return b._parent=a,b};c.createFrame=q}),define("handlebars/safe-string",["exports"],function(a){function b(a){this.string=a}b.prototype.toString=b.prototype.toHTML=function(){return""+this.string},a["default"]=b}),define("handlebars/runtime",["./utils","./exception","./base","exports"],function(a,b,c,d){function e(a){var b=a&&a[0]||1,c=n;if(b!==c){if(c>b){var d=o[c],e=o[b];throw new m("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+d+") or downgrade your runtime to an older version ("+e+").")}throw new m("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+a[1]+").")}}function f(a,b){if(!b)throw new m("No environment passed to template");if(!a||!a.main)throw new m("Unknown template object: "+typeof a);b.VM.checkRevision(a.compiler);var c=function(c,d,e){e.hash&&(d=l.extend({},d,e.hash)),c=b.VM.resolvePartial.call(this,c,d,e);var f=b.VM.invokePartial.call(this,c,d,e);if(null==f&&b.compile&&(e.partials[e.name]=b.compile(c,a.compilerOptions,b),f=e.partials[e.name](d,e)),null!=f){if(e.indent){for(var g=f.split("\n"),h=0,i=g.length;i>h&&(g[h]||h+1!==i);h++)g[h]=e.indent+g[h];f=g.join("\n")}return f}throw new m("The partial "+e.name+" could not be compiled when running in runtime-only mode")},d={strict:function(a,b){if(!(b in a))throw new m('"'+b+'" not defined in '+a);return a[b]},lookup:function(a,b){for(var c=a.length,d=0;c>d;d++)if(a[d]&&null!=a[d][b])return a[d][b]},lambda:function(a,b){return"function"==typeof a?a.call(b):a},escapeExpression:l.escapeExpression,invokePartial:c,fn:function(b){return a[b]},programs:[],program:function(a,b,c,d,e){var f=this.programs[a],h=this.fn(a);return b||e||d||c?f=g(this,a,h,b,c,d,e):f||(f=this.programs[a]=g(this,a,h)),f},data:function(a,b){for(;a&&b--;)a=a._parent;return a},merge:function(a,b){var c=a||b;return a&&b&&a!==b&&(c=l.extend({},b,a)),c},noop:b.VM.noop,compilerInfo:a.compiler},e=function(b,c){c=c||{};var f=c.data;e._setup(c),!c.partial&&a.useData&&(f=k(b,f));var g,h=a.useBlockParams?[]:void 0;return a.useDepths&&(g=c.depths?[b].concat(c.depths):[b]),a.main.call(d,b,d.helpers,d.partials,f,h,g)};return e.isTop=!0,e._setup=function(c){c.partial?(d.helpers=c.helpers,d.partials=c.partials):(d.helpers=d.merge(c.helpers,b.helpers),a.usePartial&&(d.partials=d.merge(c.partials,b.partials)))},e._child=function(b,c,e,f){if(a.useBlockParams&&!e)throw new m("must pass block params");if(a.useDepths&&!f)throw new m("must pass parent depths");return g(d,b,a[b],c,0,e,f)},e}function g(a,b,c,d,e,f,g){var h=function(b,e){return e=e||{},c.call(a,b,a.helpers,a.partials,e.data||d,f&&[e.blockParams].concat(f),g&&[b].concat(g))};return h.program=b,h.depth=g?g.length:0,h.blockParams=e||0,h}function h(a,b,c){return a?a.call||c.name||(c.name=a,a=c.partials[a]):a=c.partials[c.name],a}function i(a,b,c){if(c.partial=!0,void 0===a)throw new m("The partial "+c.name+" could not be found");return a instanceof Function?a(b,c):void 0}function j(){return""}function k(a,b){return b&&"root"in b||(b=b?p(b):{},b.root=a),b}var l=a,m=b["default"],n=c.COMPILER_REVISION,o=c.REVISION_CHANGES,p=c.createFrame;d.checkRevision=e,d.template=f,d.program=g,d.resolvePartial=h,d.invokePartial=i,d.noop=j}),define("handlebars.runtime",["./handlebars/base","./handlebars/safe-string","./handlebars/exception","./handlebars/utils","./handlebars/runtime","exports"],function(a,b,c,d,e,f){var g=a,h=b["default"],i=c["default"],j=d,k=e,l=function(){var a=new g.HandlebarsEnvironment;return j.extend(a,g),a.SafeString=h,a.Exception=i,a.Utils=j,a.escapeExpression=j.escapeExpression,a.VM=k,a.template=function(b){return k.template(b,a)},a},m=l();m.create=l;var n="undefined"!=typeof global?global:window,o=n.Handlebars;m.noConflict=function(){n.Handlebars===m&&(n.Handlebars=o)},m["default"]=m,f["default"]=m});
define("handlebars/utils",["exports"],function(a){function b(a){return i[a]}function c(a){for(var b=1;b<arguments.length;b++)for(var c in arguments[b])Object.prototype.hasOwnProperty.call(arguments[b],c)&&(a[c]=arguments[b][c]);return a}function d(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1}function e(a){if("string"!=typeof a){if(a&&a.toHTML)return a.toHTML();if(null==a)return"";if(!a)return a+"";a=""+a}return k.test(a)?a.replace(j,b):a}function f(a){return a||0===a?n(a)&&0===a.length?!0:!1:!0}function g(a,b){return a.path=b,a}function h(a,b){return(a?a+".":"")+b}a.__esModule=!0,a.extend=c,a.indexOf=d,a.escapeExpression=e,a.isEmpty=f,a.blockParams=g,a.appendContextPath=h;var i={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},j=/[&<>"'`]/g,k=/[&<>"'`]/,l=Object.prototype.toString;a.toString=l;var m=function(a){return"function"==typeof a};m(/x/)&&(a.isFunction=m=function(a){return"function"==typeof a&&"[object Function]"===l.call(a)});var m;a.isFunction=m;var n=Array.isArray||function(a){return a&&"object"==typeof a?"[object Array]"===l.call(a):!1};a.isArray=n}),define("handlebars/exception",["exports","module"],function(a,b){function c(a,b){var e=b&&b.loc,f=void 0,g=void 0;e&&(f=e.start.line,g=e.start.column,a+=" - "+f+":"+g);for(var h=Error.prototype.constructor.call(this,a),i=0;i<d.length;i++)this[d[i]]=h[d[i]];Error.captureStackTrace&&Error.captureStackTrace(this,c),e&&(this.lineNumber=f,this.column=g)}var d=["description","fileName","lineNumber","message","name","number","stack"];c.prototype=new Error,b.exports=c}),define("handlebars/base",["exports","./utils","./exception"],function(a,b,c){function d(a,b){this.helpers=a||{},this.partials=b||{},e(this)}function e(a){a.registerHelper("helperMissing",function(){if(1===arguments.length)return void 0;throw new h('Missing helper: "'+arguments[arguments.length-1].name+'"')}),a.registerHelper("blockHelperMissing",function(c,d){var e=d.inverse,g=d.fn;if(c===!0)return g(this);if(c===!1||null==c)return e(this);if(l(c))return c.length>0?(d.ids&&(d.ids=[d.name]),a.helpers.each(c,d)):e(this);if(d.data&&d.ids){var h=f(d.data);h.contextPath=b.appendContextPath(d.data.contextPath,d.name),d={data:h}}return g(c,d)}),a.registerHelper("each",function(a,c){function d(c,d,f){k&&(k.key=c,k.index=d,k.first=0===d,k.last=!!f,n&&(k.contextPath=n+c)),j+=e(a[c],{data:k,blockParams:b.blockParams([a[c],c],[n+c,null])})}if(!c)throw new h("Must pass iterator to #each");var e=c.fn,g=c.inverse,i=0,j="",k=void 0,n=void 0;if(c.data&&c.ids&&(n=b.appendContextPath(c.data.contextPath,c.ids[0])+"."),m(a)&&(a=a.call(this)),c.data&&(k=f(c.data)),a&&"object"==typeof a)if(l(a))for(var o=a.length;o>i;i++)d(i,i,i===a.length-1);else{var p=void 0;for(var q in a)a.hasOwnProperty(q)&&(p&&d(p,i-1),p=q,i++);p&&d(p,i-1,!0)}return 0===i&&(j=g(this)),j}),a.registerHelper("if",function(a,c){return m(a)&&(a=a.call(this)),!c.hash.includeZero&&!a||b.isEmpty(a)?c.inverse(this):c.fn(this)}),a.registerHelper("unless",function(b,c){return a.helpers["if"].call(this,b,{fn:c.inverse,inverse:c.fn,hash:c.hash})}),a.registerHelper("with",function(a,c){m(a)&&(a=a.call(this));var d=c.fn;if(b.isEmpty(a))return c.inverse(this);if(c.data&&c.ids){var e=f(c.data);e.contextPath=b.appendContextPath(c.data.contextPath,c.ids[0]),c={data:e}}return d(a,c)}),a.registerHelper("log",function(b,c){var d=c.data&&null!=c.data.level?parseInt(c.data.level,10):1;a.log(d,b)}),a.registerHelper("lookup",function(a,b){return a&&a[b]})}function f(a){var c=b.extend({},a);return c._parent=a,c}var g=function(a){return a&&a.__esModule?a["default"]:a};a.__esModule=!0,a.HandlebarsEnvironment=d,a.createFrame=f;var h=g(c),i="3.0.1";a.VERSION=i;var j=6;a.COMPILER_REVISION=j;var k={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1"};a.REVISION_CHANGES=k;var l=b.isArray,m=b.isFunction,n=b.toString,o="[object Object]";d.prototype={constructor:d,logger:p,log:q,registerHelper:function(a,c){if(n.call(a)===o){if(c)throw new h("Arg not supported with multiple helpers");b.extend(this.helpers,a)}else this.helpers[a]=c},unregisterHelper:function(a){delete this.helpers[a]},registerPartial:function(a,c){if(n.call(a)===o)b.extend(this.partials,a);else{if("undefined"==typeof c)throw new h("Attempting to register a partial as undefined");this.partials[a]=c}},unregisterPartial:function(a){delete this.partials[a]}};var p={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:1,log:function(a,b){if("undefined"!=typeof console&&p.level<=a){var c=p.methodMap[a];(console[c]||console.log).call(console,b)}}};a.logger=p;var q=p.log;a.log=q}),define("handlebars/safe-string",["exports","module"],function(a,b){function c(a){this.string=a}c.prototype.toString=c.prototype.toHTML=function(){return""+this.string},b.exports=c}),define("handlebars/runtime",["exports","./utils","./exception","./base"],function(a,b,c,d){function e(a){var b=a&&a[0]||1,c=d.COMPILER_REVISION;if(b!==c){if(c>b){var e=d.REVISION_CHANGES[c],f=d.REVISION_CHANGES[b];throw new m("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+e+") or downgrade your runtime to an older version ("+f+").")}throw new m("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+a[1]+").")}}function f(a,c){function d(d,e,f){f.hash&&(e=b.extend({},e,f.hash)),d=c.VM.resolvePartial.call(this,d,e,f);var g=c.VM.invokePartial.call(this,d,e,f);if(null==g&&c.compile&&(f.partials[f.name]=c.compile(d,a.compilerOptions,c),g=f.partials[f.name](e,f)),null!=g){if(f.indent){for(var h=g.split("\n"),i=0,j=h.length;j>i&&(h[i]||i+1!==j);i++)h[i]=f.indent+h[i];g=h.join("\n")}return g}throw new m("The partial "+f.name+" could not be compiled when running in runtime-only mode")}function e(b){var c=void 0===arguments[1]?{}:arguments[1],d=c.data;e._setup(c),!c.partial&&a.useData&&(d=k(b,d));var g=void 0,h=a.useBlockParams?[]:void 0;return a.useDepths&&(g=c.depths?[b].concat(c.depths):[b]),a.main.call(f,b,f.helpers,f.partials,d,h,g)}if(!c)throw new m("No environment passed to template");if(!a||!a.main)throw new m("Unknown template object: "+typeof a);c.VM.checkRevision(a.compiler);var f={strict:function(a,b){if(!(b in a))throw new m('"'+b+'" not defined in '+a);return a[b]},lookup:function(a,b){for(var c=a.length,d=0;c>d;d++)if(a[d]&&null!=a[d][b])return a[d][b]},lambda:function(a,b){return"function"==typeof a?a.call(b):a},escapeExpression:b.escapeExpression,invokePartial:d,fn:function(b){return a[b]},programs:[],program:function(a,b,c,d,e){var f=this.programs[a],h=this.fn(a);return b||e||d||c?f=g(this,a,h,b,c,d,e):f||(f=this.programs[a]=g(this,a,h)),f},data:function(a,b){for(;a&&b--;)a=a._parent;return a},merge:function(a,c){var d=a||c;return a&&c&&a!==c&&(d=b.extend({},c,a)),d},noop:c.VM.noop,compilerInfo:a.compiler};return e.isTop=!0,e._setup=function(b){b.partial?(f.helpers=b.helpers,f.partials=b.partials):(f.helpers=f.merge(b.helpers,c.helpers),a.usePartial&&(f.partials=f.merge(b.partials,c.partials)))},e._child=function(b,c,d,e){if(a.useBlockParams&&!d)throw new m("must pass block params");if(a.useDepths&&!e)throw new m("must pass parent depths");return g(f,b,a[b],c,0,d,e)},e}function g(a,b,c,d,e,f,g){function h(b){var e=void 0===arguments[1]?{}:arguments[1];return c.call(a,b,a.helpers,a.partials,e.data||d,f&&[e.blockParams].concat(f),g&&[b].concat(g))}return h.program=b,h.depth=g?g.length:0,h.blockParams=e||0,h}function h(a,b,c){return a?a.call||c.name||(c.name=a,a=c.partials[a]):a=c.partials[c.name],a}function i(a,b,c){if(c.partial=!0,void 0===a)throw new m("The partial "+c.name+" could not be found");return a instanceof Function?a(b,c):void 0}function j(){return""}function k(a,b){return b&&"root"in b||(b=b?d.createFrame(b):{},b.root=a),b}var l=function(a){return a&&a.__esModule?a["default"]:a};a.__esModule=!0,a.checkRevision=e,a.template=f,a.wrapProgram=g,a.resolvePartial=h,a.invokePartial=i,a.noop=j;var m=l(c)}),define("handlebars.runtime",["exports","module","./handlebars/base","./handlebars/safe-string","./handlebars/exception","./handlebars/utils","./handlebars/runtime"],function(a,b,c,d,e,f,g){function h(){var a=new c.HandlebarsEnvironment;return f.extend(a,c),a.SafeString=j,a.Exception=k,a.Utils=f,a.escapeExpression=f.escapeExpression,a.VM=g,a.template=function(b){return g.template(b,a)},a}var i=function(a){return a&&a.__esModule?a["default"]:a},j=i(d),k=i(e),l=h();l.create=h;var m="undefined"!=typeof global?global:window,n=m.Handlebars;l.noConflict=function(){m.Handlebars===l&&(m.Handlebars=n)},l["default"]=l,b.exports=l});
/*!
handlebars v3.0.1
handlebars v3.0.2

@@ -27,703 +27,840 @@ Copyright (C) 2011-2014 by Yehuda Katz

*/
/* exported Handlebars */
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define([], factory);
} else if (typeof exports === 'object') {
module.exports = factory();
} else {
root.Handlebars = factory();
}
}(this, function () {
// handlebars/utils.js
var __module2__ = (function() {
"use strict";
var __exports__ = {};
/*jshint -W004 */
var escape = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#x27;",
"`": "&#x60;"
};
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define(factory);
else if(typeof exports === 'object')
exports["Handlebars"] = factory();
else
root["Handlebars"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
var badChars = /[&<>"'`]/g;
var possible = /[&<>"'`]/;
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
function escapeChar(chr) {
return escape[chr];
}
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
function extend(obj /* , ...source */) {
for (var i = 1; i < arguments.length; i++) {
for (var key in arguments[i]) {
if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
obj[key] = arguments[i][key];
}
}
}
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
return obj;
}
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
__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
/* istanbul ignore next */
if (isFunction(/x/)) {
isFunction = function(value) {
return typeof value === 'function' && toString.call(value) === '[object Function]';
};
}
var isFunction;
__exports__.isFunction = isFunction;
/* istanbul ignore next */
var isArray = Array.isArray || function(value) {
return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false;
};
__exports__.isArray = isArray;
// Older IE versions do not directly support indexOf so we must implement our own, sadly.
function indexOf(array, value) {
for (var i = 0, len = array.length; i < len; i++) {
if (array[i] === value) {
return i;
}
}
return -1;
}
/******/ // Flag the module as loaded
/******/ module.loaded = true;
__exports__.indexOf = indexOf;
function escapeExpression(string) {
if (typeof string !== 'string') {
// don't escape SafeStrings, since they're already safe
if (string && string.toHTML) {
return string.toHTML();
} else if (string == null) {
return '';
} else if (!string) {
return string + '';
}
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
// 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);
}
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
__exports__.escapeExpression = escapeExpression;function isEmpty(value) {
if (!value && value !== 0) {
return true;
} else if (isArray(value) && value.length === 0) {
return true;
} else {
return false;
}
}
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
__exports__.isEmpty = isEmpty;function blockParams(params, ids) {
params.path = ids;
return params;
}
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
__exports__.blockParams = blockParams;function appendContextPath(contextPath, id) {
return (contextPath ? contextPath + '.' : '') + id;
}
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
__exports__.appendContextPath = appendContextPath;
return __exports__;
})();
/* WEBPACK VAR INJECTION */(function(global) {'use strict';
// handlebars/exception.js
var __module3__ = (function() {
"use strict";
var __exports__;
var _interopRequireWildcard = __webpack_require__(6)['default'];
var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
exports.__esModule = true;
/*global window */
function Exception(message, node) {
var loc = node && node.loc,
line,
column;
if (loc) {
line = loc.start.line;
column = loc.start.column;
var _import = __webpack_require__(1);
message += ' - ' + line + ':' + column;
}
var base = _interopRequireWildcard(_import);
var tmp = Error.prototype.constructor.call(this, message);
// Each of these augment the Handlebars object. No need to setup here.
// (This is done to easily share code between commonjs and browse envs)
// 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]];
}
var _SafeString = __webpack_require__(2);
if (loc) {
this.lineNumber = line;
this.column = column;
}
}
var _SafeString2 = _interopRequireWildcard(_SafeString);
Exception.prototype = new Error();
var _Exception = __webpack_require__(3);
__exports__ = Exception;
return __exports__;
})();
var _Exception2 = _interopRequireWildcard(_Exception);
// handlebars/base.js
var __module1__ = (function(__dependency1__, __dependency2__) {
"use strict";
var __exports__ = {};
var Utils = __dependency1__;
var Exception = __dependency2__;
var _import2 = __webpack_require__(4);
var VERSION = "3.0.1";
__exports__.VERSION = VERSION;var COMPILER_REVISION = 6;
__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.x.x',
5: '== 2.0.0-alpha.x',
6: '>= 2.0.0-beta.1'
};
__exports__.REVISION_CHANGES = REVISION_CHANGES;
var isArray = Utils.isArray,
isFunction = Utils.isFunction,
toString = Utils.toString,
objectType = '[object Object]';
var Utils = _interopRequireWildcard(_import2);
function HandlebarsEnvironment(helpers, partials) {
this.helpers = helpers || {};
this.partials = partials || {};
var _import3 = __webpack_require__(5);
registerDefaultHelpers(this);
}
var runtime = _interopRequireWildcard(_import3);
__exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = {
constructor: HandlebarsEnvironment,
// For compatibility and usage outside of module systems, make the Handlebars object a namespace
function create() {
var hb = new base.HandlebarsEnvironment();
logger: logger,
log: log,
Utils.extend(hb, base);
hb.SafeString = _SafeString2['default'];
hb.Exception = _Exception2['default'];
hb.Utils = Utils;
hb.escapeExpression = Utils.escapeExpression;
registerHelper: function(name, fn) {
if (toString.call(name) === objectType) {
if (fn) { throw new Exception('Arg not supported with multiple helpers'); }
Utils.extend(this.helpers, name);
} else {
this.helpers[name] = fn;
}
},
unregisterHelper: function(name) {
delete this.helpers[name];
},
hb.VM = runtime;
hb.template = function (spec) {
return runtime.template(spec, hb);
};
registerPartial: function(name, partial) {
if (toString.call(name) === objectType) {
Utils.extend(this.partials, name);
} else {
if (typeof partial === 'undefined') {
throw new Exception('Attempting to register a partial as undefined');
}
this.partials[name] = partial;
}
},
unregisterPartial: function(name) {
delete this.partials[name];
}
};
return hb;
}
function registerDefaultHelpers(instance) {
instance.registerHelper('helperMissing', function(/* [args, ]options */) {
if(arguments.length === 1) {
// A missing field in a {{foo}} constuct.
return undefined;
} else {
// Someone is actually trying to call something, blow up.
throw new Exception("Missing helper: '" + arguments[arguments.length-1].name + "'");
}
});
var Handlebars = create();
Handlebars.create = create;
instance.registerHelper('blockHelperMissing', function(context, options) {
var inverse = options.inverse,
fn = options.fn;
/*jshint -W040 */
/* istanbul ignore next */
var root = typeof global !== 'undefined' ? global : window,
$Handlebars = root.Handlebars;
/* istanbul ignore next */
Handlebars.noConflict = function () {
if (root.Handlebars === Handlebars) {
root.Handlebars = $Handlebars;
}
};
if(context === true) {
return fn(this);
} else if(context === false || context == null) {
return inverse(this);
} else if (isArray(context)) {
if(context.length > 0) {
if (options.ids) {
options.ids = [options.name];
}
Handlebars['default'] = Handlebars;
return instance.helpers.each(context, options);
} else {
return inverse(this);
}
} else {
if (options.data && options.ids) {
var data = createFrame(options.data);
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name);
options = {data: data};
}
exports['default'] = Handlebars;
module.exports = exports['default'];
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
return fn(context, options);
}
});
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
instance.registerHelper('each', function(context, options) {
if (!options) {
throw new Exception('Must pass iterator to #each');
}
'use strict';
var fn = options.fn, inverse = options.inverse;
var i = 0, ret = "", data;
var _interopRequireWildcard = __webpack_require__(6)['default'];
var contextPath;
if (options.data && options.ids) {
contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';
}
exports.__esModule = true;
exports.HandlebarsEnvironment = HandlebarsEnvironment;
exports.createFrame = createFrame;
if (isFunction(context)) { context = context.call(this); }
var _import = __webpack_require__(4);
if (options.data) {
data = createFrame(options.data);
}
var Utils = _interopRequireWildcard(_import);
function execIteration(key, i, last) {
if (data) {
data.key = key;
data.index = i;
data.first = i === 0;
data.last = !!last;
var _Exception = __webpack_require__(3);
if (contextPath) {
data.contextPath = contextPath + key;
}
}
var _Exception2 = _interopRequireWildcard(_Exception);
ret = ret + fn(context[key], {
data: data,
blockParams: Utils.blockParams([context[key], key], [contextPath + key, null])
});
}
var VERSION = '3.0.1';
exports.VERSION = VERSION;
var COMPILER_REVISION = 6;
if(context && typeof context === 'object') {
if (isArray(context)) {
for(var j = context.length; i<j; i++) {
execIteration(i, i, i === context.length-1);
}
} else {
var priorKey;
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.x.x',
5: '== 2.0.0-alpha.x',
6: '>= 2.0.0-beta.1'
};
for(var key in context) {
if(context.hasOwnProperty(key)) {
// We're running the iterations one step out of sync so we can detect
// the last iteration without have to scan the object twice and create
// an itermediate keys array.
if (priorKey) {
execIteration(priorKey, i-1);
}
priorKey = key;
i++;
}
}
if (priorKey) {
execIteration(priorKey, i-1, true);
}
}
}
exports.REVISION_CHANGES = REVISION_CHANGES;
var isArray = Utils.isArray,
isFunction = Utils.isFunction,
toString = Utils.toString,
objectType = '[object Object]';
if(i === 0){
ret = inverse(this);
}
function HandlebarsEnvironment(helpers, partials) {
this.helpers = helpers || {};
this.partials = partials || {};
return ret;
});
registerDefaultHelpers(this);
}
instance.registerHelper('if', function(conditional, options) {
if (isFunction(conditional)) { conditional = conditional.call(this); }
HandlebarsEnvironment.prototype = {
constructor: HandlebarsEnvironment,
// Default behavior is to render the positive path if the value is truthy and not empty.
// The `includeZero` option may be set to treat the condtional as purely not empty based on the
// behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
if ((!options.hash.includeZero && !conditional) || Utils.isEmpty(conditional)) {
return options.inverse(this);
} else {
return options.fn(this);
}
});
logger: logger,
log: log,
instance.registerHelper('unless', function(conditional, options) {
return instance.helpers['if'].call(this, conditional, {fn: options.inverse, inverse: options.fn, hash: options.hash});
});
registerHelper: function registerHelper(name, fn) {
if (toString.call(name) === objectType) {
if (fn) {
throw new _Exception2['default']('Arg not supported with multiple helpers');
}
Utils.extend(this.helpers, name);
} else {
this.helpers[name] = fn;
}
},
unregisterHelper: function unregisterHelper(name) {
delete this.helpers[name];
},
instance.registerHelper('with', function(context, options) {
if (isFunction(context)) { context = context.call(this); }
registerPartial: function registerPartial(name, partial) {
if (toString.call(name) === objectType) {
Utils.extend(this.partials, name);
} else {
if (typeof partial === 'undefined') {
throw new _Exception2['default']('Attempting to register a partial as undefined');
}
this.partials[name] = partial;
}
},
unregisterPartial: function unregisterPartial(name) {
delete this.partials[name];
}
};
var fn = options.fn;
function registerDefaultHelpers(instance) {
instance.registerHelper('helperMissing', function () {
if (arguments.length === 1) {
// A missing field in a {{foo}} constuct.
return undefined;
} else {
// Someone is actually trying to call something, blow up.
throw new _Exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"');
}
});
if (!Utils.isEmpty(context)) {
if (options.data && options.ids) {
var data = createFrame(options.data);
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]);
options = {data:data};
}
instance.registerHelper('blockHelperMissing', function (context, options) {
var inverse = options.inverse,
fn = options.fn;
return fn(context, options);
} else {
return options.inverse(this);
}
});
if (context === true) {
return fn(this);
} else if (context === false || context == null) {
return inverse(this);
} else if (isArray(context)) {
if (context.length > 0) {
if (options.ids) {
options.ids = [options.name];
}
instance.registerHelper('log', function(message, options) {
var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
instance.log(level, message);
});
return instance.helpers.each(context, options);
} else {
return inverse(this);
}
} else {
if (options.data && options.ids) {
var data = createFrame(options.data);
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name);
options = { data: data };
}
instance.registerHelper('lookup', function(obj, field) {
return obj && obj[field];
});
}
return fn(context, options);
}
});
var logger = {
methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' },
instance.registerHelper('each', function (context, options) {
if (!options) {
throw new _Exception2['default']('Must pass iterator to #each');
}
// State enum
DEBUG: 0,
INFO: 1,
WARN: 2,
ERROR: 3,
level: 1,
var fn = options.fn,
inverse = options.inverse,
i = 0,
ret = '',
data = undefined,
contextPath = undefined;
// Can be overridden in the host environment
log: function(level, message) {
if (typeof console !== 'undefined' && logger.level <= level) {
var method = logger.methodMap[level];
(console[method] || console.log).call(console, message);
}
}
};
__exports__.logger = logger;
var log = logger.log;
__exports__.log = log;
var createFrame = function(object) {
var frame = Utils.extend({}, object);
frame._parent = object;
return frame;
};
__exports__.createFrame = createFrame;
return __exports__;
})(__module2__, __module3__);
if (options.data && options.ids) {
contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';
}
// handlebars/safe-string.js
var __module4__ = (function() {
"use strict";
var __exports__;
// Build out our basic SafeString type
function SafeString(string) {
this.string = string;
}
if (isFunction(context)) {
context = context.call(this);
}
SafeString.prototype.toString = SafeString.prototype.toHTML = function() {
return "" + this.string;
};
if (options.data) {
data = createFrame(options.data);
}
__exports__ = SafeString;
return __exports__;
})();
function execIteration(field, index, last) {
if (data) {
data.key = field;
data.index = index;
data.first = index === 0;
data.last = !!last;
// handlebars/runtime.js
var __module5__ = (function(__dependency1__, __dependency2__, __dependency3__) {
"use strict";
var __exports__ = {};
var Utils = __dependency1__;
var Exception = __dependency2__;
var COMPILER_REVISION = __dependency3__.COMPILER_REVISION;
var REVISION_CHANGES = __dependency3__.REVISION_CHANGES;
var createFrame = __dependency3__.createFrame;
if (contextPath) {
data.contextPath = contextPath + field;
}
}
function checkRevision(compilerInfo) {
var compilerRevision = compilerInfo && compilerInfo[0] || 1,
currentRevision = COMPILER_REVISION;
ret = ret + fn(context[field], {
data: data,
blockParams: Utils.blockParams([context[field], field], [contextPath + field, null])
});
}
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]+").");
}
}
}
if (context && typeof context === 'object') {
if (isArray(context)) {
for (var j = context.length; i < j; i++) {
execIteration(i, i, i === context.length - 1);
}
} else {
var priorKey = undefined;
__exports__.checkRevision = checkRevision;// TODO: Remove this line and break up compilePartial
for (var key in context) {
if (context.hasOwnProperty(key)) {
// We're running the iterations one step out of sync so we can detect
// the last iteration without have to scan the object twice and create
// an itermediate keys array.
if (priorKey) {
execIteration(priorKey, i - 1);
}
priorKey = key;
i++;
}
}
if (priorKey) {
execIteration(priorKey, i - 1, true);
}
}
}
function template(templateSpec, env) {
/* istanbul ignore next */
if (!env) {
throw new Exception("No environment passed to template");
}
if (!templateSpec || !templateSpec.main) {
throw new Exception('Unknown template object: ' + typeof templateSpec);
}
if (i === 0) {
ret = inverse(this);
}
// 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.
env.VM.checkRevision(templateSpec.compiler);
return ret;
});
var invokePartialWrapper = function(partial, context, options) {
if (options.hash) {
context = Utils.extend({}, context, options.hash);
}
instance.registerHelper('if', function (conditional, options) {
if (isFunction(conditional)) {
conditional = conditional.call(this);
}
partial = env.VM.resolvePartial.call(this, partial, context, options);
var result = env.VM.invokePartial.call(this, partial, context, options);
// Default behavior is to render the positive path if the value is truthy and not empty.
// The `includeZero` option may be set to treat the condtional as purely not empty based on the
// behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
if (!options.hash.includeZero && !conditional || Utils.isEmpty(conditional)) {
return options.inverse(this);
} else {
return options.fn(this);
}
});
if (result == null && env.compile) {
options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env);
result = options.partials[options.name](context, options);
}
if (result != null) {
if (options.indent) {
var lines = result.split('\n');
for (var i = 0, l = lines.length; i < l; i++) {
if (!lines[i] && i + 1 === l) {
break;
}
instance.registerHelper('unless', function (conditional, options) {
return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash });
});
lines[i] = options.indent + lines[i];
}
result = lines.join('\n');
}
return result;
} else {
throw new Exception("The partial " + options.name + " could not be compiled when running in runtime-only mode");
}
};
instance.registerHelper('with', function (context, options) {
if (isFunction(context)) {
context = context.call(this);
}
// Just add water
var container = {
strict: function(obj, name) {
if (!(name in obj)) {
throw new Exception('"' + name + '" not defined in ' + obj);
}
return obj[name];
},
lookup: function(depths, name) {
var len = depths.length;
for (var i = 0; i < len; i++) {
if (depths[i] && depths[i][name] != null) {
return depths[i][name];
}
}
},
lambda: function(current, context) {
return typeof current === 'function' ? current.call(context) : current;
},
var fn = options.fn;
escapeExpression: Utils.escapeExpression,
invokePartial: invokePartialWrapper,
if (!Utils.isEmpty(context)) {
if (options.data && options.ids) {
var data = createFrame(options.data);
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]);
options = { data: data };
}
fn: function(i) {
return templateSpec[i];
},
return fn(context, options);
} else {
return options.inverse(this);
}
});
programs: [],
program: function(i, data, declaredBlockParams, blockParams, depths) {
var programWrapper = this.programs[i],
fn = this.fn(i);
if (data || depths || blockParams || declaredBlockParams) {
programWrapper = program(this, i, fn, data, declaredBlockParams, blockParams, depths);
} else if (!programWrapper) {
programWrapper = this.programs[i] = program(this, i, fn);
}
return programWrapper;
},
instance.registerHelper('log', function (message, options) {
var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
instance.log(level, message);
});
data: function(data, depth) {
while (data && depth--) {
data = data._parent;
}
return data;
},
merge: function(param, common) {
var ret = param || common;
instance.registerHelper('lookup', function (obj, field) {
return obj && obj[field];
});
}
if (param && common && (param !== common)) {
ret = Utils.extend({}, common, param);
}
var logger = {
methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' },
return ret;
},
// State enum
DEBUG: 0,
INFO: 1,
WARN: 2,
ERROR: 3,
level: 1,
noop: env.VM.noop,
compilerInfo: templateSpec.compiler
};
// Can be overridden in the host environment
log: function log(level, message) {
if (typeof console !== 'undefined' && logger.level <= level) {
var method = logger.methodMap[level];
(console[method] || console.log).call(console, message); // eslint-disable-line no-console
}
}
};
var ret = function(context, options) {
options = options || {};
var data = options.data;
exports.logger = logger;
var log = logger.log;
ret._setup(options);
if (!options.partial && templateSpec.useData) {
data = initData(context, data);
}
var depths,
blockParams = templateSpec.useBlockParams ? [] : undefined;
if (templateSpec.useDepths) {
depths = options.depths ? [context].concat(options.depths) : [context];
}
exports.log = log;
return templateSpec.main.call(container, context, container.helpers, container.partials, data, blockParams, depths);
};
ret.isTop = true;
function createFrame(object) {
var frame = Utils.extend({}, object);
frame._parent = object;
return frame;
}
ret._setup = function(options) {
if (!options.partial) {
container.helpers = container.merge(options.helpers, env.helpers);
/* [args, ]options */
if (templateSpec.usePartial) {
container.partials = container.merge(options.partials, env.partials);
}
} else {
container.helpers = options.helpers;
container.partials = options.partials;
}
};
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
ret._child = function(i, data, blockParams, depths) {
if (templateSpec.useBlockParams && !blockParams) {
throw new Exception('must pass block params');
}
if (templateSpec.useDepths && !depths) {
throw new Exception('must pass parent depths');
}
'use strict';
return program(container, i, templateSpec[i], data, 0, blockParams, depths);
};
return ret;
}
exports.__esModule = true;
// Build out our basic SafeString type
function SafeString(string) {
this.string = string;
}
__exports__.template = template;function program(container, i, fn, data, declaredBlockParams, blockParams, depths) {
var prog = function(context, options) {
options = options || {};
SafeString.prototype.toString = SafeString.prototype.toHTML = function () {
return '' + this.string;
};
return fn.call(container,
context,
container.helpers, container.partials,
options.data || data,
blockParams && [options.blockParams].concat(blockParams),
depths && [context].concat(depths));
};
prog.program = i;
prog.depth = depths ? depths.length : 0;
prog.blockParams = declaredBlockParams || 0;
return prog;
}
exports['default'] = SafeString;
module.exports = exports['default'];
__exports__.program = program;function resolvePartial(partial, context, options) {
if (!partial) {
partial = options.partials[options.name];
} else if (!partial.call && !options.name) {
// This is a dynamic partial that returned a string
options.name = partial;
partial = options.partials[partial];
}
return partial;
}
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
__exports__.resolvePartial = resolvePartial;function invokePartial(partial, context, options) {
options.partial = true;
'use strict';
if(partial === undefined) {
throw new Exception("The partial " + options.name + " could not be found");
} else if(partial instanceof Function) {
return partial(context, options);
}
}
exports.__esModule = true;
__exports__.invokePartial = invokePartial;function noop() { return ""; }
var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
__exports__.noop = noop;function initData(context, data) {
if (!data || !('root' in data)) {
data = data ? createFrame(data) : {};
data.root = context;
}
return data;
}
return __exports__;
})(__module2__, __module3__, __module1__);
function Exception(message, node) {
var loc = node && node.loc,
line = undefined,
column = undefined;
if (loc) {
line = loc.start.line;
column = loc.start.column;
// handlebars.runtime.js
var __module0__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) {
"use strict";
var __exports__;
/*globals Handlebars: true */
var base = __dependency1__;
message += ' - ' + line + ':' + column;
}
// Each of these augment the Handlebars object. No need to setup here.
// (This is done to easily share code between commonjs and browse envs)
var SafeString = __dependency2__;
var Exception = __dependency3__;
var Utils = __dependency4__;
var runtime = __dependency5__;
var tmp = Error.prototype.constructor.call(this, message);
// For compatibility and usage outside of module systems, make the Handlebars object a namespace
var create = function() {
var hb = new base.HandlebarsEnvironment();
// 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]];
}
Utils.extend(hb, base);
hb.SafeString = SafeString;
hb.Exception = Exception;
hb.Utils = Utils;
hb.escapeExpression = Utils.escapeExpression;
if (Error.captureStackTrace) {
Error.captureStackTrace(this, Exception);
}
hb.VM = runtime;
hb.template = function(spec) {
return runtime.template(spec, hb);
};
if (loc) {
this.lineNumber = line;
this.column = column;
}
}
return hb;
};
Exception.prototype = new Error();
var Handlebars = create();
Handlebars.create = create;
exports['default'] = Exception;
module.exports = exports['default'];
/*jshint -W040 */
/* istanbul ignore next */
var root = typeof global !== 'undefined' ? global : window,
$Handlebars = root.Handlebars;
/* istanbul ignore next */
Handlebars.noConflict = function() {
if (root.Handlebars === Handlebars) {
root.Handlebars = $Handlebars;
}
};
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
Handlebars['default'] = Handlebars;
'use strict';
__exports__ = Handlebars;
return __exports__;
})(__module1__, __module4__, __module3__, __module2__, __module5__);
exports.__esModule = true;
exports.extend = extend;
return __module0__;
}));
// Older IE versions do not directly support indexOf so we must implement our own, sadly.
exports.indexOf = indexOf;
exports.escapeExpression = escapeExpression;
exports.isEmpty = isEmpty;
exports.blockParams = blockParams;
exports.appendContextPath = appendContextPath;
/*jshint -W004 */
var escape = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
'\'': '&#x27;',
'`': '&#x60;'
};
var badChars = /[&<>"'`]/g,
possible = /[&<>"'`]/;
function escapeChar(chr) {
return escape[chr];
}
function extend(obj /* , ...source */) {
for (var i = 1; i < arguments.length; i++) {
for (var key in arguments[i]) {
if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
obj[key] = arguments[i][key];
}
}
}
return obj;
}
var toString = Object.prototype.toString;
exports.toString = toString;
// Sourced from lodash
// https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
/*eslint-disable func-style, no-var */
var isFunction = function isFunction(value) {
return typeof value === 'function';
};
// fallback for older versions of Chrome and Safari
/* istanbul ignore next */
if (isFunction(/x/)) {
exports.isFunction = isFunction = function (value) {
return typeof value === 'function' && toString.call(value) === '[object Function]';
};
}
var isFunction;
exports.isFunction = isFunction;
/*eslint-enable func-style, no-var */
/* istanbul ignore next */
var isArray = Array.isArray || function (value) {
return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false;
};exports.isArray = isArray;
function indexOf(array, value) {
for (var i = 0, len = array.length; i < len; i++) {
if (array[i] === value) {
return i;
}
}
return -1;
}
function escapeExpression(string) {
if (typeof string !== 'string') {
// don't escape SafeStrings, since they're already safe
if (string && string.toHTML) {
return string.toHTML();
} else if (string == null) {
return '';
} else if (!string) {
return string + '';
}
// 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);
}
function isEmpty(value) {
if (!value && value !== 0) {
return true;
} else if (isArray(value) && value.length === 0) {
return true;
} else {
return false;
}
}
function blockParams(params, ids) {
params.path = ids;
return params;
}
function appendContextPath(contextPath, id) {
return (contextPath ? contextPath + '.' : '') + id;
}
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _interopRequireWildcard = __webpack_require__(6)['default'];
exports.__esModule = true;
exports.checkRevision = checkRevision;
// TODO: Remove this line and break up compilePartial
exports.template = template;
exports.wrapProgram = wrapProgram;
exports.resolvePartial = resolvePartial;
exports.invokePartial = invokePartial;
exports.noop = noop;
var _import = __webpack_require__(4);
var Utils = _interopRequireWildcard(_import);
var _Exception = __webpack_require__(3);
var _Exception2 = _interopRequireWildcard(_Exception);
var _COMPILER_REVISION$REVISION_CHANGES$createFrame = __webpack_require__(1);
function checkRevision(compilerInfo) {
var compilerRevision = compilerInfo && compilerInfo[0] || 1,
currentRevision = _COMPILER_REVISION$REVISION_CHANGES$createFrame.COMPILER_REVISION;
if (compilerRevision !== currentRevision) {
if (compilerRevision < currentRevision) {
var runtimeVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[currentRevision],
compilerVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[compilerRevision];
throw new _Exception2['default']('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 _Exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').');
}
}
}
function template(templateSpec, env) {
/* istanbul ignore next */
if (!env) {
throw new _Exception2['default']('No environment passed to template');
}
if (!templateSpec || !templateSpec.main) {
throw new _Exception2['default']('Unknown template object: ' + typeof templateSpec);
}
// 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.
env.VM.checkRevision(templateSpec.compiler);
function invokePartialWrapper(partial, context, options) {
if (options.hash) {
context = Utils.extend({}, context, options.hash);
}
partial = env.VM.resolvePartial.call(this, partial, context, options);
var result = env.VM.invokePartial.call(this, partial, context, options);
if (result == null && env.compile) {
options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env);
result = options.partials[options.name](context, options);
}
if (result != null) {
if (options.indent) {
var lines = result.split('\n');
for (var i = 0, l = lines.length; i < l; i++) {
if (!lines[i] && i + 1 === l) {
break;
}
lines[i] = options.indent + lines[i];
}
result = lines.join('\n');
}
return result;
} else {
throw new _Exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode');
}
}
// Just add water
var container = {
strict: function strict(obj, name) {
if (!(name in obj)) {
throw new _Exception2['default']('"' + name + '" not defined in ' + obj);
}
return obj[name];
},
lookup: function lookup(depths, name) {
var len = depths.length;
for (var i = 0; i < len; i++) {
if (depths[i] && depths[i][name] != null) {
return depths[i][name];
}
}
},
lambda: function lambda(current, context) {
return typeof current === 'function' ? current.call(context) : current;
},
escapeExpression: Utils.escapeExpression,
invokePartial: invokePartialWrapper,
fn: function fn(i) {
return templateSpec[i];
},
programs: [],
program: function program(i, data, declaredBlockParams, blockParams, depths) {
var programWrapper = this.programs[i],
fn = this.fn(i);
if (data || depths || blockParams || declaredBlockParams) {
programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths);
} else if (!programWrapper) {
programWrapper = this.programs[i] = wrapProgram(this, i, fn);
}
return programWrapper;
},
data: function data(value, depth) {
while (value && depth--) {
value = value._parent;
}
return value;
},
merge: function merge(param, common) {
var obj = param || common;
if (param && common && param !== common) {
obj = Utils.extend({}, common, param);
}
return obj;
},
noop: env.VM.noop,
compilerInfo: templateSpec.compiler
};
function ret(context) {
var options = arguments[1] === undefined ? {} : arguments[1];
var data = options.data;
ret._setup(options);
if (!options.partial && templateSpec.useData) {
data = initData(context, data);
}
var depths = undefined,
blockParams = templateSpec.useBlockParams ? [] : undefined;
if (templateSpec.useDepths) {
depths = options.depths ? [context].concat(options.depths) : [context];
}
return templateSpec.main.call(container, context, container.helpers, container.partials, data, blockParams, depths);
}
ret.isTop = true;
ret._setup = function (options) {
if (!options.partial) {
container.helpers = container.merge(options.helpers, env.helpers);
if (templateSpec.usePartial) {
container.partials = container.merge(options.partials, env.partials);
}
} else {
container.helpers = options.helpers;
container.partials = options.partials;
}
};
ret._child = function (i, data, blockParams, depths) {
if (templateSpec.useBlockParams && !blockParams) {
throw new _Exception2['default']('must pass block params');
}
if (templateSpec.useDepths && !depths) {
throw new _Exception2['default']('must pass parent depths');
}
return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths);
};
return ret;
}
function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) {
function prog(context) {
var options = arguments[1] === undefined ? {} : arguments[1];
return fn.call(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), depths && [context].concat(depths));
}
prog.program = i;
prog.depth = depths ? depths.length : 0;
prog.blockParams = declaredBlockParams || 0;
return prog;
}
function resolvePartial(partial, context, options) {
if (!partial) {
partial = options.partials[options.name];
} else if (!partial.call && !options.name) {
// This is a dynamic partial that returned a string
options.name = partial;
partial = options.partials[partial];
}
return partial;
}
function invokePartial(partial, context, options) {
options.partial = true;
if (partial === undefined) {
throw new _Exception2['default']('The partial ' + options.name + ' could not be found');
} else if (partial instanceof Function) {
return partial(context, options);
}
}
function noop() {
return '';
}
function initData(context, data) {
if (!data || !('root' in data)) {
data = data ? _COMPILER_REVISION$REVISION_CHANGES$createFrame.createFrame(data) : {};
data.root = context;
}
return data;
}
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports["default"] = function (obj) {
return obj && obj.__esModule ? obj : {
"default": obj
};
};
exports.__esModule = true;
/***/ }
/******/ ])
});
;
/*!
handlebars v3.0.1
handlebars v3.0.2

@@ -27,2 +27,2 @@ Copyright (C) 2011-2014 by Yehuda Katz

*/
!function(a,b){"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?module.exports=b():a.Handlebars=b()}(this,function(){var a=function(){"use strict";function a(a){return i[a]}function b(a){for(var b=1;b<arguments.length;b++)for(var c in arguments[b])Object.prototype.hasOwnProperty.call(arguments[b],c)&&(a[c]=arguments[b][c]);return a}function c(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1}function d(b){if("string"!=typeof b){if(b&&b.toHTML)return b.toHTML();if(null==b)return"";if(!b)return b+"";b=""+b}return k.test(b)?b.replace(j,a):b}function e(a){return a||0===a?n(a)&&0===a.length?!0:!1:!0}function f(a,b){return a.path=b,a}function g(a,b){return(a?a+".":"")+b}var h={},i={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},j=/[&<>"'`]/g,k=/[&<>"'`]/;h.extend=b;var l=Object.prototype.toString;h.toString=l;var m=function(a){return"function"==typeof a};m(/x/)&&(m=function(a){return"function"==typeof a&&"[object Function]"===l.call(a)});var m;h.isFunction=m;var n=Array.isArray||function(a){return a&&"object"==typeof a?"[object Array]"===l.call(a):!1};return h.isArray=n,h.indexOf=c,h.escapeExpression=d,h.isEmpty=e,h.blockParams=f,h.appendContextPath=g,h}(),b=function(){"use strict";function a(a,b){var d,e,f=b&&b.loc;f&&(d=f.start.line,e=f.start.column,a+=" - "+d+":"+e);for(var g=Error.prototype.constructor.call(this,a),h=0;h<c.length;h++)this[c[h]]=g[c[h]];f&&(this.lineNumber=d,this.column=e)}var b,c=["description","fileName","lineNumber","message","name","number","stack"];return a.prototype=new Error,b=a}(),c=function(a,b){"use strict";function c(a,b){this.helpers=a||{},this.partials=b||{},d(this)}function d(a){a.registerHelper("helperMissing",function(){if(1===arguments.length)return void 0;throw new g("Missing helper: '"+arguments[arguments.length-1].name+"'")}),a.registerHelper("blockHelperMissing",function(b,c){var d=c.inverse,e=c.fn;if(b===!0)return e(this);if(b===!1||null==b)return d(this);if(k(b))return b.length>0?(c.ids&&(c.ids=[c.name]),a.helpers.each(b,c)):d(this);if(c.data&&c.ids){var g=q(c.data);g.contextPath=f.appendContextPath(c.data.contextPath,c.name),c={data:g}}return e(b,c)}),a.registerHelper("each",function(a,b){function c(b,c,g){d&&(d.key=b,d.index=c,d.first=0===c,d.last=!!g,e&&(d.contextPath=e+b)),m+=h(a[b],{data:d,blockParams:f.blockParams([a[b],b],[e+b,null])})}if(!b)throw new g("Must pass iterator to #each");var d,e,h=b.fn,i=b.inverse,j=0,m="";if(b.data&&b.ids&&(e=f.appendContextPath(b.data.contextPath,b.ids[0])+"."),l(a)&&(a=a.call(this)),b.data&&(d=q(b.data)),a&&"object"==typeof a)if(k(a))for(var n=a.length;n>j;j++)c(j,j,j===a.length-1);else{var o;for(var p in a)a.hasOwnProperty(p)&&(o&&c(o,j-1),o=p,j++);o&&c(o,j-1,!0)}return 0===j&&(m=i(this)),m}),a.registerHelper("if",function(a,b){return l(a)&&(a=a.call(this)),!b.hash.includeZero&&!a||f.isEmpty(a)?b.inverse(this):b.fn(this)}),a.registerHelper("unless",function(b,c){return a.helpers["if"].call(this,b,{fn:c.inverse,inverse:c.fn,hash:c.hash})}),a.registerHelper("with",function(a,b){l(a)&&(a=a.call(this));var c=b.fn;if(f.isEmpty(a))return b.inverse(this);if(b.data&&b.ids){var d=q(b.data);d.contextPath=f.appendContextPath(b.data.contextPath,b.ids[0]),b={data:d}}return c(a,b)}),a.registerHelper("log",function(b,c){var d=c.data&&null!=c.data.level?parseInt(c.data.level,10):1;a.log(d,b)}),a.registerHelper("lookup",function(a,b){return a&&a[b]})}var e={},f=a,g=b,h="3.0.1";e.VERSION=h;var i=6;e.COMPILER_REVISION=i;var j={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1"};e.REVISION_CHANGES=j;var k=f.isArray,l=f.isFunction,m=f.toString,n="[object Object]";e.HandlebarsEnvironment=c,c.prototype={constructor:c,logger:o,log:p,registerHelper:function(a,b){if(m.call(a)===n){if(b)throw new g("Arg not supported with multiple helpers");f.extend(this.helpers,a)}else this.helpers[a]=b},unregisterHelper:function(a){delete this.helpers[a]},registerPartial:function(a,b){if(m.call(a)===n)f.extend(this.partials,a);else{if("undefined"==typeof b)throw new g("Attempting to register a partial as undefined");this.partials[a]=b}},unregisterPartial:function(a){delete this.partials[a]}};var o={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:1,log:function(a,b){if("undefined"!=typeof console&&o.level<=a){var c=o.methodMap[a];(console[c]||console.log).call(console,b)}}};e.logger=o;var p=o.log;e.log=p;var q=function(a){var b=f.extend({},a);return b._parent=a,b};return e.createFrame=q,e}(a,b),d=function(){"use strict";function a(a){this.string=a}var b;return a.prototype.toString=a.prototype.toHTML=function(){return""+this.string},b=a}(),e=function(a,b,c){"use strict";function d(a){var b=a&&a[0]||1,c=n;if(b!==c){if(c>b){var d=o[c],e=o[b];throw new m("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+d+") or downgrade your runtime to an older version ("+e+").")}throw new m("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+a[1]+").")}}function e(a,b){if(!b)throw new m("No environment passed to template");if(!a||!a.main)throw new m("Unknown template object: "+typeof a);b.VM.checkRevision(a.compiler);var c=function(c,d,e){e.hash&&(d=l.extend({},d,e.hash)),c=b.VM.resolvePartial.call(this,c,d,e);var f=b.VM.invokePartial.call(this,c,d,e);if(null==f&&b.compile&&(e.partials[e.name]=b.compile(c,a.compilerOptions,b),f=e.partials[e.name](d,e)),null!=f){if(e.indent){for(var g=f.split("\n"),h=0,i=g.length;i>h&&(g[h]||h+1!==i);h++)g[h]=e.indent+g[h];f=g.join("\n")}return f}throw new m("The partial "+e.name+" could not be compiled when running in runtime-only mode")},d={strict:function(a,b){if(!(b in a))throw new m('"'+b+'" not defined in '+a);return a[b]},lookup:function(a,b){for(var c=a.length,d=0;c>d;d++)if(a[d]&&null!=a[d][b])return a[d][b]},lambda:function(a,b){return"function"==typeof a?a.call(b):a},escapeExpression:l.escapeExpression,invokePartial:c,fn:function(b){return a[b]},programs:[],program:function(a,b,c,d,e){var g=this.programs[a],h=this.fn(a);return b||e||d||c?g=f(this,a,h,b,c,d,e):g||(g=this.programs[a]=f(this,a,h)),g},data:function(a,b){for(;a&&b--;)a=a._parent;return a},merge:function(a,b){var c=a||b;return a&&b&&a!==b&&(c=l.extend({},b,a)),c},noop:b.VM.noop,compilerInfo:a.compiler},e=function(b,c){c=c||{};var f=c.data;e._setup(c),!c.partial&&a.useData&&(f=j(b,f));var g,h=a.useBlockParams?[]:void 0;return a.useDepths&&(g=c.depths?[b].concat(c.depths):[b]),a.main.call(d,b,d.helpers,d.partials,f,h,g)};return e.isTop=!0,e._setup=function(c){c.partial?(d.helpers=c.helpers,d.partials=c.partials):(d.helpers=d.merge(c.helpers,b.helpers),a.usePartial&&(d.partials=d.merge(c.partials,b.partials)))},e._child=function(b,c,e,g){if(a.useBlockParams&&!e)throw new m("must pass block params");if(a.useDepths&&!g)throw new m("must pass parent depths");return f(d,b,a[b],c,0,e,g)},e}function f(a,b,c,d,e,f,g){var h=function(b,e){return e=e||{},c.call(a,b,a.helpers,a.partials,e.data||d,f&&[e.blockParams].concat(f),g&&[b].concat(g))};return h.program=b,h.depth=g?g.length:0,h.blockParams=e||0,h}function g(a,b,c){return a?a.call||c.name||(c.name=a,a=c.partials[a]):a=c.partials[c.name],a}function h(a,b,c){if(c.partial=!0,void 0===a)throw new m("The partial "+c.name+" could not be found");return a instanceof Function?a(b,c):void 0}function i(){return""}function j(a,b){return b&&"root"in b||(b=b?p(b):{},b.root=a),b}var k={},l=a,m=b,n=c.COMPILER_REVISION,o=c.REVISION_CHANGES,p=c.createFrame;return k.checkRevision=d,k.template=e,k.program=f,k.resolvePartial=g,k.invokePartial=h,k.noop=i,k}(a,b,c),f=function(a,b,c,d,e){"use strict";var f,g=a,h=b,i=c,j=d,k=e,l=function(){var a=new g.HandlebarsEnvironment;return j.extend(a,g),a.SafeString=h,a.Exception=i,a.Utils=j,a.escapeExpression=j.escapeExpression,a.VM=k,a.template=function(b){return k.template(b,a)},a},m=l();m.create=l;var n="undefined"!=typeof global?global:window,o=n.Handlebars;return m.noConflict=function(){n.Handlebars===m&&(n.Handlebars=o)},m["default"]=m,f=m}(c,d,b,a,e);return f});
!function(a,b){"object"==typeof exports&&"object"==typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):"object"==typeof exports?exports.Handlebars=b():a.Handlebars=b()}(this,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a,b,c){(function(d){"use strict";function e(){var a=new h.HandlebarsEnvironment;return n.extend(a,h),a.SafeString=j["default"],a.Exception=l["default"],a.Utils=n,a.escapeExpression=n.escapeExpression,a.VM=p,a.template=function(b){return p.template(b,a)},a}var f=c(6)["default"];b.__esModule=!0;var g=c(1),h=f(g),i=c(2),j=f(i),k=c(3),l=f(k),m=c(4),n=f(m),o=c(5),p=f(o),q=e();q.create=e;var r="undefined"!=typeof d?d:window,s=r.Handlebars;q.noConflict=function(){r.Handlebars===q&&(r.Handlebars=s)},q["default"]=q,b["default"]=q,a.exports=b["default"]}).call(b,function(){return this}())},function(a,b,c){"use strict";function d(a,b){this.helpers=a||{},this.partials=b||{},e(this)}function e(a){a.registerHelper("helperMissing",function(){if(1===arguments.length)return void 0;throw new k["default"]('Missing helper: "'+arguments[arguments.length-1].name+'"')}),a.registerHelper("blockHelperMissing",function(b,c){var d=c.inverse,e=c.fn;if(b===!0)return e(this);if(b===!1||null==b)return d(this);if(o(b))return b.length>0?(c.ids&&(c.ids=[c.name]),a.helpers.each(b,c)):d(this);if(c.data&&c.ids){var g=f(c.data);g.contextPath=i.appendContextPath(c.data.contextPath,c.name),c={data:g}}return e(b,c)}),a.registerHelper("each",function(a,b){function c(b,c,e){j&&(j.key=b,j.index=c,j.first=0===c,j.last=!!e,l&&(j.contextPath=l+b)),h+=d(a[b],{data:j,blockParams:i.blockParams([a[b],b],[l+b,null])})}if(!b)throw new k["default"]("Must pass iterator to #each");var d=b.fn,e=b.inverse,g=0,h="",j=void 0,l=void 0;if(b.data&&b.ids&&(l=i.appendContextPath(b.data.contextPath,b.ids[0])+"."),p(a)&&(a=a.call(this)),b.data&&(j=f(b.data)),a&&"object"==typeof a)if(o(a))for(var m=a.length;m>g;g++)c(g,g,g===a.length-1);else{var n=void 0;for(var q in a)a.hasOwnProperty(q)&&(n&&c(n,g-1),n=q,g++);n&&c(n,g-1,!0)}return 0===g&&(h=e(this)),h}),a.registerHelper("if",function(a,b){return p(a)&&(a=a.call(this)),!b.hash.includeZero&&!a||i.isEmpty(a)?b.inverse(this):b.fn(this)}),a.registerHelper("unless",function(b,c){return a.helpers["if"].call(this,b,{fn:c.inverse,inverse:c.fn,hash:c.hash})}),a.registerHelper("with",function(a,b){p(a)&&(a=a.call(this));var c=b.fn;if(i.isEmpty(a))return b.inverse(this);if(b.data&&b.ids){var d=f(b.data);d.contextPath=i.appendContextPath(b.data.contextPath,b.ids[0]),b={data:d}}return c(a,b)}),a.registerHelper("log",function(b,c){var d=c.data&&null!=c.data.level?parseInt(c.data.level,10):1;a.log(d,b)}),a.registerHelper("lookup",function(a,b){return a&&a[b]})}function f(a){var b=i.extend({},a);return b._parent=a,b}var g=c(6)["default"];b.__esModule=!0,b.HandlebarsEnvironment=d,b.createFrame=f;var h=c(4),i=g(h),j=c(3),k=g(j),l="3.0.1";b.VERSION=l;var m=6;b.COMPILER_REVISION=m;var n={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1"};b.REVISION_CHANGES=n;var o=i.isArray,p=i.isFunction,q=i.toString,r="[object Object]";d.prototype={constructor:d,logger:s,log:t,registerHelper:function(a,b){if(q.call(a)===r){if(b)throw new k["default"]("Arg not supported with multiple helpers");i.extend(this.helpers,a)}else this.helpers[a]=b},unregisterHelper:function(a){delete this.helpers[a]},registerPartial:function(a,b){if(q.call(a)===r)i.extend(this.partials,a);else{if("undefined"==typeof b)throw new k["default"]("Attempting to register a partial as undefined");this.partials[a]=b}},unregisterPartial:function(a){delete this.partials[a]}};var s={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:1,log:function(a,b){if("undefined"!=typeof console&&s.level<=a){var c=s.methodMap[a];(console[c]||console.log).call(console,b)}}};b.logger=s;var t=s.log;b.log=t},function(a,b){"use strict";function c(a){this.string=a}b.__esModule=!0,c.prototype.toString=c.prototype.toHTML=function(){return""+this.string},b["default"]=c,a.exports=b["default"]},function(a,b){"use strict";function c(a,b){var e=b&&b.loc,f=void 0,g=void 0;e&&(f=e.start.line,g=e.start.column,a+=" - "+f+":"+g);for(var h=Error.prototype.constructor.call(this,a),i=0;i<d.length;i++)this[d[i]]=h[d[i]];Error.captureStackTrace&&Error.captureStackTrace(this,c),e&&(this.lineNumber=f,this.column=g)}b.__esModule=!0;var d=["description","fileName","lineNumber","message","name","number","stack"];c.prototype=new Error,b["default"]=c,a.exports=b["default"]},function(a,b){"use strict";function c(a){return j[a]}function d(a){for(var b=1;b<arguments.length;b++)for(var c in arguments[b])Object.prototype.hasOwnProperty.call(arguments[b],c)&&(a[c]=arguments[b][c]);return a}function e(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1}function f(a){if("string"!=typeof a){if(a&&a.toHTML)return a.toHTML();if(null==a)return"";if(!a)return a+"";a=""+a}return l.test(a)?a.replace(k,c):a}function g(a){return a||0===a?o(a)&&0===a.length?!0:!1:!0}function h(a,b){return a.path=b,a}function i(a,b){return(a?a+".":"")+b}b.__esModule=!0,b.extend=d,b.indexOf=e,b.escapeExpression=f,b.isEmpty=g,b.blockParams=h,b.appendContextPath=i;var j={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},k=/[&<>"'`]/g,l=/[&<>"'`]/,m=Object.prototype.toString;b.toString=m;var n=function(a){return"function"==typeof a};n(/x/)&&(b.isFunction=n=function(a){return"function"==typeof a&&"[object Function]"===m.call(a)});var n;b.isFunction=n;var o=Array.isArray||function(a){return a&&"object"==typeof a?"[object Array]"===m.call(a):!1};b.isArray=o},function(a,b,c){"use strict";function d(a){var b=a&&a[0]||1,c=p.COMPILER_REVISION;if(b!==c){if(c>b){var d=p.REVISION_CHANGES[c],e=p.REVISION_CHANGES[b];throw new o["default"]("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+d+") or downgrade your runtime to an older version ("+e+").")}throw new o["default"]("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+a[1]+").")}}function e(a,b){function c(c,d,e){e.hash&&(d=m.extend({},d,e.hash)),c=b.VM.resolvePartial.call(this,c,d,e);var f=b.VM.invokePartial.call(this,c,d,e);if(null==f&&b.compile&&(e.partials[e.name]=b.compile(c,a.compilerOptions,b),f=e.partials[e.name](d,e)),null!=f){if(e.indent){for(var g=f.split("\n"),h=0,i=g.length;i>h&&(g[h]||h+1!==i);h++)g[h]=e.indent+g[h];f=g.join("\n")}return f}throw new o["default"]("The partial "+e.name+" could not be compiled when running in runtime-only mode")}function d(b){var c=void 0===arguments[1]?{}:arguments[1],f=c.data;d._setup(c),!c.partial&&a.useData&&(f=j(b,f));var g=void 0,h=a.useBlockParams?[]:void 0;return a.useDepths&&(g=c.depths?[b].concat(c.depths):[b]),a.main.call(e,b,e.helpers,e.partials,f,h,g)}if(!b)throw new o["default"]("No environment passed to template");if(!a||!a.main)throw new o["default"]("Unknown template object: "+typeof a);b.VM.checkRevision(a.compiler);var e={strict:function(a,b){if(!(b in a))throw new o["default"]('"'+b+'" not defined in '+a);return a[b]},lookup:function(a,b){for(var c=a.length,d=0;c>d;d++)if(a[d]&&null!=a[d][b])return a[d][b]},lambda:function(a,b){return"function"==typeof a?a.call(b):a},escapeExpression:m.escapeExpression,invokePartial:c,fn:function(b){return a[b]},programs:[],program:function(a,b,c,d,e){var g=this.programs[a],h=this.fn(a);return b||e||d||c?g=f(this,a,h,b,c,d,e):g||(g=this.programs[a]=f(this,a,h)),g},data:function(a,b){for(;a&&b--;)a=a._parent;return a},merge:function(a,b){var c=a||b;return a&&b&&a!==b&&(c=m.extend({},b,a)),c},noop:b.VM.noop,compilerInfo:a.compiler};return d.isTop=!0,d._setup=function(c){c.partial?(e.helpers=c.helpers,e.partials=c.partials):(e.helpers=e.merge(c.helpers,b.helpers),a.usePartial&&(e.partials=e.merge(c.partials,b.partials)))},d._child=function(b,c,d,g){if(a.useBlockParams&&!d)throw new o["default"]("must pass block params");if(a.useDepths&&!g)throw new o["default"]("must pass parent depths");return f(e,b,a[b],c,0,d,g)},d}function f(a,b,c,d,e,f,g){function h(b){var e=void 0===arguments[1]?{}:arguments[1];return c.call(a,b,a.helpers,a.partials,e.data||d,f&&[e.blockParams].concat(f),g&&[b].concat(g))}return h.program=b,h.depth=g?g.length:0,h.blockParams=e||0,h}function g(a,b,c){return a?a.call||c.name||(c.name=a,a=c.partials[a]):a=c.partials[c.name],a}function h(a,b,c){if(c.partial=!0,void 0===a)throw new o["default"]("The partial "+c.name+" could not be found");return a instanceof Function?a(b,c):void 0}function i(){return""}function j(a,b){return b&&"root"in b||(b=b?p.createFrame(b):{},b.root=a),b}var k=c(6)["default"];b.__esModule=!0,b.checkRevision=d,b.template=e,b.wrapProgram=f,b.resolvePartial=g,b.invokePartial=h,b.noop=i;var l=c(4),m=k(l),n=c(3),o=k(n),p=c(1)},function(a,b){"use strict";b["default"]=function(a){return a&&a.__esModule?a:{"default":a}},b.__esModule=!0}])});

@@ -167,2 +167,10 @@ # Handlebars Compiler APIs

}
interface UndefinedLiteral <: Literal {
type: "UndefinedLiteral";
}
interface NullLiteral <: Literal {
type: "NullLiteral";
}
```

@@ -169,0 +177,0 @@

@@ -1,13 +0,13 @@

/*globals Handlebars: true */
import Handlebars from "./handlebars.runtime";
import Handlebars from './handlebars.runtime';
// Compiler imports
import AST from "./handlebars/compiler/ast";
import { parser as Parser, parse } from "./handlebars/compiler/base";
import { Compiler, compile, precompile } from "./handlebars/compiler/compiler";
import JavaScriptCompiler from "./handlebars/compiler/javascript-compiler";
import AST from './handlebars/compiler/ast';
import { parser as Parser, parse } from './handlebars/compiler/base';
import { Compiler, compile, precompile } from './handlebars/compiler/compiler';
import JavaScriptCompiler from './handlebars/compiler/javascript-compiler';
import Visitor from './handlebars/compiler/visitor';
var _create = Handlebars.create;
var create = function() {
var hb = _create();
let _create = Handlebars.create;
function create() {
let hb = _create();

@@ -17,3 +17,3 @@ hb.compile = function(input, options) {

};
hb.precompile = function (input, options) {
hb.precompile = function(input, options) {
return precompile(input, options, hb);

@@ -29,20 +29,21 @@ };

return hb;
};
}
Handlebars = create();
Handlebars.create = create;
let inst = create();
inst.create = create;
inst.Visitor = Visitor;
/*jshint -W040 */
/* istanbul ignore next */
var root = typeof global !== 'undefined' ? global : window,
$Handlebars = root.Handlebars;
let $Handlebars = global.Handlebars;
/* istanbul ignore next */
Handlebars.noConflict = function() {
if (root.Handlebars === Handlebars) {
root.Handlebars = $Handlebars;
inst.noConflict = function() {
if (global.Handlebars === inst) {
global.Handlebars = $Handlebars;
}
};
Handlebars['default'] = Handlebars;
inst['default'] = inst;
export default Handlebars;
export default inst;

@@ -1,14 +0,14 @@

/*globals Handlebars: true */
module base from "./handlebars/base";
/*global window */
import * as base from './handlebars/base';
// Each of these augment the Handlebars object. No need to setup here.
// (This is done to easily share code between commonjs and browse envs)
import SafeString from "./handlebars/safe-string";
import Exception from "./handlebars/exception";
module Utils from "./handlebars/utils";
module runtime from "./handlebars/runtime";
import SafeString from './handlebars/safe-string';
import Exception from './handlebars/exception';
import * as Utils from './handlebars/utils';
import * as runtime from './handlebars/runtime';
// For compatibility and usage outside of module systems, make the Handlebars object a namespace
var create = function() {
var hb = new base.HandlebarsEnvironment();
function create() {
let hb = new base.HandlebarsEnvironment();

@@ -27,5 +27,5 @@ Utils.extend(hb, base);

return hb;
};
}
var Handlebars = create();
let Handlebars = create();
Handlebars.create = create;

@@ -35,3 +35,3 @@

/* istanbul ignore next */
var root = typeof global !== 'undefined' ? global : window,
let root = typeof global !== 'undefined' ? global : window,
$Handlebars = root.Handlebars;

@@ -38,0 +38,0 @@ /* istanbul ignore next */

@@ -1,8 +0,8 @@

module Utils from "./utils";
import Exception from "./exception";
import * as Utils from './utils';
import Exception from './exception';
export var VERSION = "3.0.1";
export var COMPILER_REVISION = 6;
export const VERSION = '3.0.1';
export const COMPILER_REVISION = 6;
export var REVISION_CHANGES = {
export const REVISION_CHANGES = {
1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it

@@ -16,6 +16,6 @@ 2: '== 1.0.0-rc.3',

var isArray = Utils.isArray,
isFunction = Utils.isFunction,
toString = Utils.toString,
objectType = '[object Object]';
const isArray = Utils.isArray,
isFunction = Utils.isFunction,
toString = Utils.toString,
objectType = '[object Object]';

@@ -49,3 +49,3 @@ export function HandlebarsEnvironment(helpers, partials) {

if (toString.call(name) === objectType) {
Utils.extend(this.partials, name);
Utils.extend(this.partials, name);
} else {

@@ -65,3 +65,3 @@ if (typeof partial === 'undefined') {

instance.registerHelper('helperMissing', function(/* [args, ]options */) {
if(arguments.length === 1) {
if (arguments.length === 1) {
// A missing field in a {{foo}} constuct.

@@ -71,3 +71,3 @@ return undefined;

// Someone is actually trying to call something, blow up.
throw new Exception("Missing helper: '" + arguments[arguments.length-1].name + "'");
throw new Exception('Missing helper: "' + arguments[arguments.length - 1].name + '"');
}

@@ -77,11 +77,11 @@ });

instance.registerHelper('blockHelperMissing', function(context, options) {
var inverse = options.inverse,
let inverse = options.inverse,
fn = options.fn;
if(context === true) {
if (context === true) {
return fn(this);
} else if(context === false || context == null) {
} else if (context === false || context == null) {
return inverse(this);
} else if (isArray(context)) {
if(context.length > 0) {
if (context.length > 0) {
if (options.ids) {

@@ -97,3 +97,3 @@ options.ids = [options.name];

if (options.data && options.ids) {
var data = createFrame(options.data);
let data = createFrame(options.data);
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name);

@@ -112,6 +112,9 @@ options = {data: data};

var fn = options.fn, inverse = options.inverse;
var i = 0, ret = "", data;
let fn = options.fn,
inverse = options.inverse,
i = 0,
ret = '',
data,
contextPath;
var contextPath;
if (options.data && options.ids) {

@@ -127,35 +130,35 @@ contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';

function execIteration(key, i, last) {
function execIteration(field, index, last) {
if (data) {
data.key = key;
data.index = i;
data.first = i === 0;
data.last = !!last;
data.key = field;
data.index = index;
data.first = index === 0;
data.last = !!last;
if (contextPath) {
data.contextPath = contextPath + key;
data.contextPath = contextPath + field;
}
}
ret = ret + fn(context[key], {
ret = ret + fn(context[field], {
data: data,
blockParams: Utils.blockParams([context[key], key], [contextPath + key, null])
blockParams: Utils.blockParams([context[field], field], [contextPath + field, null])
});
}
if(context && typeof context === 'object') {
if (context && typeof context === 'object') {
if (isArray(context)) {
for(var j = context.length; i<j; i++) {
execIteration(i, i, i === context.length-1);
for (let j = context.length; i < j; i++) {
execIteration(i, i, i === context.length - 1);
}
} else {
var priorKey;
let priorKey;
for(var key in context) {
if(context.hasOwnProperty(key)) {
for (let key in context) {
if (context.hasOwnProperty(key)) {
// We're running the iterations one step out of sync so we can detect
// the last iteration without have to scan the object twice and create
// an itermediate keys array.
// an itermediate keys array.
if (priorKey) {
execIteration(priorKey, i-1);
execIteration(priorKey, i - 1);
}

@@ -167,3 +170,3 @@ priorKey = key;

if (priorKey) {
execIteration(priorKey, i-1, true);
execIteration(priorKey, i - 1, true);
}

@@ -173,3 +176,3 @@ }

if(i === 0){
if (i === 0) {
ret = inverse(this);

@@ -201,9 +204,9 @@ }

var fn = options.fn;
let fn = options.fn;
if (!Utils.isEmpty(context)) {
if (options.data && options.ids) {
var data = createFrame(options.data);
let data = createFrame(options.data);
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]);
options = {data:data};
options = {data: data};
}

@@ -218,3 +221,3 @@

instance.registerHelper('log', function(message, options) {
var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
let level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
instance.log(level, message);

@@ -228,3 +231,3 @@ });

export var logger = {
export let logger = {
methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' },

@@ -242,4 +245,4 @@

if (typeof console !== 'undefined' && logger.level <= level) {
var method = logger.methodMap[level];
(console[method] || console.log).call(console, message);
let method = logger.methodMap[level];
(console[method] || console.log).call(console, message); // eslint-disable-line no-console
}

@@ -249,8 +252,8 @@ }

export var log = logger.log;
export let log = logger.log;
export var createFrame = function(object) {
var frame = Utils.extend({}, object);
export function createFrame(object) {
let frame = Utils.extend({}, object);
frame._parent = object;
return frame;
};
}

@@ -1,2 +0,2 @@

var AST = {
let AST = {
Program: function(statements, blockParams, strip, locInfo) {

@@ -30,4 +30,4 @@ this.loc = locInfo;

this.hash = hash;
this.program = program;
this.inverse = inverse;
this.program = program;
this.inverse = inverse;

@@ -80,4 +80,4 @@ this.openStrip = openStrip;

this.original = original;
this.parts = parts;
this.depth = depth;
this.parts = parts;
this.depth = depth;
},

@@ -106,2 +106,14 @@

UndefinedLiteral: function(locInfo) {
this.loc = locInfo;
this.type = 'UndefinedLiteral';
this.original = this.value = undefined;
},
NullLiteral: function(locInfo) {
this.loc = locInfo;
this.type = 'NullLiteral';
this.original = this.value = null;
},
Hash: function(pairs, locInfo) {

@@ -124,3 +136,2 @@ this.loc = locInfo;

// * it has at least one parameter or hash segment
// TODO: Make these public utility methods
helperExpression: function(node) {

@@ -127,0 +138,0 @@ return !!(node.type === 'SubExpression' || node.params.length || node.hash);

@@ -1,10 +0,10 @@

import parser from "./parser";
import AST from "./ast";
import WhitespaceControl from "./whitespace-control";
module Helpers from "./helpers";
import { extend } from "../utils";
import parser from './parser';
import AST from './ast';
import WhitespaceControl from './whitespace-control';
import * as Helpers from './helpers';
import { extend } from '../utils';
export { parser };
var yy = {};
let yy = {};
extend(yy, Helpers, AST);

@@ -23,4 +23,4 @@

var strip = new WhitespaceControl();
let strip = new WhitespaceControl();
return strip.accept(parser.parse(input));
}

@@ -1,8 +0,20 @@

import {isArray} from "../utils";
/*global define */
import {isArray} from '../utils';
let SourceNode;
try {
var SourceMap = require('source-map'),
SourceNode = SourceMap.SourceNode;
/* istanbul ignore next */
if (typeof define !== 'function' || !define.amd) {
// We don't support this in AMD environments. For these environments, we asusme that
// they are running on the browser and thus have no need for the source-map library.
let SourceMap = require('source-map');
SourceNode = SourceMap.SourceNode;
}
} catch (err) {
/* istanbul ignore next: tested but not covered in istanbul due to dist build */
/* NOP */
}
/* istanbul ignore if: tested but not covered in istanbul due to dist build */
if (!SourceNode) {
SourceNode = function(line, column, srcFile, chunks) {

@@ -40,5 +52,5 @@ this.src = '';

if (isArray(chunk)) {
var ret = [];
let ret = [];
for (var i = 0, len = chunk.length; i < len; i++) {
for (let i = 0, len = chunk.length; i < len; i++) {
ret.push(codeGen.wrap(chunk[i], loc));

@@ -49,3 +61,3 @@ }

// Handle primitives that the SourceNode will throw up on
return chunk+'';
return chunk + '';
}

@@ -70,3 +82,3 @@ return chunk;

merge: function() {
var source = this.empty();
let source = this.empty();
this.each(function(line) {

@@ -79,3 +91,3 @@ source.add([' ', line, '\n']);

each: function(iter) {
for (var i = 0, len = this.source.length; i < len; i++) {
for (let i = 0, len = this.source.length; i < len; i++) {
iter(this.source[i]);

@@ -85,7 +97,6 @@ }

empty: function(loc) {
loc = loc || this.currentLocation || {start:{}};
empty: function(loc = this.currentLocation || {start: {}}) {
return new SourceNode(loc.start.line, loc.start.column, this.srcFile);
},
wrap: function(chunk, loc) {
wrap: function(chunk, loc = this.currentLocation || {start: {}}) {
if (chunk instanceof SourceNode) {

@@ -95,3 +106,2 @@ return chunk;

loc = loc || this.currentLocation || {start:{}};
chunk = castChunk(chunk, this, loc);

@@ -118,7 +128,7 @@

objectLiteral: function(obj) {
var pairs = [];
let pairs = [];
for (var key in obj) {
for (let key in obj) {
if (obj.hasOwnProperty(key)) {
var value = castChunk(obj[key], this);
let value = castChunk(obj[key], this);
if (value !== 'undefined') {

@@ -130,3 +140,3 @@ pairs.push([this.quotedString(key), ':', value]);

var ret = this.generateList(pairs);
let ret = this.generateList(pairs);
ret.prepend('{');

@@ -139,5 +149,5 @@ ret.add('}');

generateList: function(entries, loc) {
var ret = this.empty(loc);
let ret = this.empty(loc);
for (var i = 0, len = entries.length; i < len; i++) {
for (let i = 0, len = entries.length; i < len; i++) {
if (i) {

@@ -154,3 +164,3 @@ ret.add(',');

generateArray: function(entries, loc) {
var ret = this.generateList(entries, loc);
let ret = this.generateList(entries, loc);
ret.prepend('[');

@@ -157,0 +167,0 @@ ret.add(']');

@@ -1,8 +0,7 @@

import Exception from "../exception";
import {isArray, indexOf} from "../utils";
import AST from "./ast";
import Exception from '../exception';
import {isArray, indexOf} from '../utils';
import AST from './ast';
var slice = [].slice;
const slice = [].slice;
export function Compiler() {}

@@ -19,3 +18,3 @@

equals: function(other) {
var len = this.opcodes.length;
let len = this.opcodes.length;
if (other.opcodes.length !== len) {

@@ -25,4 +24,4 @@ return false;

for (var i = 0; i < len; i++) {
var opcode = this.opcodes[i],
for (let i = 0; i < len; i++) {
let opcode = this.opcodes[i],
otherOpcode = other.opcodes[i];

@@ -37,3 +36,3 @@ if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) {

len = this.children.length;
for (i = 0; i < len; i++) {
for (let i = 0; i < len; i++) {
if (!this.children[i].equals(other.children[i])) {

@@ -60,3 +59,3 @@ return false;

// These changes will propagate to the other compiler components
var knownHelpers = options.knownHelpers;
let knownHelpers = options.knownHelpers;
options.knownHelpers = {

@@ -73,4 +72,6 @@ 'helperMissing': true,

if (knownHelpers) {
for (var name in knownHelpers) {
options.knownHelpers[name] = knownHelpers[name];
for (let name in knownHelpers) {
if (name in knownHelpers) {
options.knownHelpers[name] = knownHelpers[name];
}
}

@@ -83,4 +84,5 @@ }

compileProgram: function(program) {
var result = new this.compiler().compile(program, this.options);
var guid = this.guid++;
let childCompiler = new this.compiler(), // eslint-disable-line new-cap
result = childCompiler.compile(program, this.options),
guid = this.guid++;

@@ -97,3 +99,3 @@ this.usePartial = this.usePartial || result.usePartial;

this.sourceNode.unshift(node);
var ret = this[node.type](node);
let ret = this[node.type](node);
this.sourceNode.shift();

@@ -106,4 +108,5 @@ return ret;

var body = program.body;
for(var i=0, l=body.length; i<l; i++) {
let body = program.body,
bodyLength = body.length;
for (let i = 0; i < bodyLength; i++) {
this.accept(body[i]);

@@ -114,3 +117,3 @@ }

this.isSimple = l === 1;
this.isSimple = bodyLength === 1;
this.blockParams = program.blockParams ? program.blockParams.length : 0;

@@ -124,3 +127,3 @@

var program = block.program,
let program = block.program,
inverse = block.inverse;

@@ -131,3 +134,3 @@

var type = this.classifySexpr(block);
let type = this.classifySexpr(block);

@@ -162,3 +165,3 @@ if (type === 'helper') {

var params = partial.params;
let params = partial.params;
if (params.length > 1) {

@@ -170,3 +173,3 @@ throw new Exception('Unsupported number of partial arguments: ' + params.length, partial);

var partialName = partial.name.original,
let partialName = partial.name.original,
isDynamic = partial.name.type === 'SubExpression';

@@ -179,3 +182,3 @@ if (isDynamic) {

var indent = partial.indent || '';
let indent = partial.indent || '';
if (this.options.preventIndent && indent) {

@@ -191,5 +194,5 @@ this.opcode('appendContent', indent);

MustacheStatement: function(mustache) {
this.SubExpression(mustache);
this.SubExpression(mustache); // eslint-disable-line new-cap
if(mustache.escaped && !this.options.noEscape) {
if (mustache.escaped && !this.options.noEscape) {
this.opcode('appendEscaped');

@@ -211,3 +214,3 @@ } else {

transformLiteralToPath(sexpr);
var type = this.classifySexpr(sexpr);
let type = this.classifySexpr(sexpr);

@@ -223,3 +226,3 @@ if (type === 'simple') {

ambiguousSexpr: function(sexpr, program, inverse) {
var path = sexpr.path,
let path = sexpr.path,
name = path.parts[0],

@@ -244,3 +247,3 @@ isBlock = program != null || inverse != null;

helperSexpr: function(sexpr, program, inverse) {
var params = this.setupFullMustacheParams(sexpr, program, inverse),
let params = this.setupFullMustacheParams(sexpr, program, inverse),
path = sexpr.path,

@@ -252,3 +255,3 @@ name = path.parts[0];

} else if (this.options.knownHelpersOnly) {
throw new Exception("You specified knownHelpersOnly, but used the unknown helper " + name, sexpr);
throw new Exception('You specified knownHelpersOnly, but used the unknown helper ' + name, sexpr);
} else {

@@ -266,3 +269,3 @@ path.falsy = true;

var name = path.parts[0],
let name = path.parts[0],
scoped = AST.helpers.scopedId(path),

@@ -273,3 +276,3 @@ blockParamId = !path.depth && !scoped && this.blockParamIndex(name);

this.opcode('lookupBlockParam', blockParamId, path.parts);
} else if (!name) {
} else if (!name) {
// Context reference, i.e. `{{foo .}}` or `{{foo ..}}`

@@ -297,8 +300,18 @@ this.opcode('pushContext');

UndefinedLiteral: function() {
this.opcode('pushLiteral', 'undefined');
},
NullLiteral: function() {
this.opcode('pushLiteral', 'null');
},
Hash: function(hash) {
var pairs = hash.pairs, i, l;
let pairs = hash.pairs,
i = 0,
l = pairs.length;
this.opcode('pushHash');
for (i=0, l=pairs.length; i<l; i++) {
for (; i < l; i++) {
this.pushParam(pairs[i].value);

@@ -326,9 +339,9 @@ }

classifySexpr: function(sexpr) {
var isSimple = AST.helpers.simpleId(sexpr.path);
let isSimple = AST.helpers.simpleId(sexpr.path);
var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]);
let isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]);
// a mustache is an eligible helper if:
// * its id is simple (a single part, not `this` or `..`)
var isHelper = !isBlockParam && AST.helpers.helperExpression(sexpr);
let isHelper = !isBlockParam && AST.helpers.helperExpression(sexpr);

@@ -338,10 +351,9 @@ // if a mustache is an eligible helper but not a definite

// pass or at runtime.
var isEligible = !isBlockParam && (isHelper || isSimple);
let isEligible = !isBlockParam && (isHelper || isSimple);
var options = this.options;
// if ambiguous, we can possibly resolve the ambiguity now
// An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc.
if (isEligible && !isHelper) {
var name = sexpr.path.parts[0];
let name = sexpr.path.parts[0],
options = this.options;

@@ -355,9 +367,13 @@ if (options.knownHelpers[name]) {

if (isHelper) { return 'helper'; }
else if (isEligible) { return 'ambiguous'; }
else { return 'simple'; }
if (isHelper) {
return 'helper';
} else if (isEligible) {
return 'ambiguous';
} else {
return 'simple';
}
},
pushParams: function(params) {
for(var i=0, l=params.length; i<l; i++) {
for (let i = 0, l = params.length; i < l; i++) {
this.pushParam(params[i]);

@@ -368,3 +384,3 @@ }

pushParam: function(val) {
var value = val.value != null ? val.value : val.original || '';
let value = val.value != null ? val.value : val.original || '';

@@ -378,3 +394,3 @@ if (this.stringParams) {

if(val.depth) {
if (val.depth) {
this.addDepth(val.depth);

@@ -392,3 +408,3 @@ }

if (this.trackIds) {
var blockParamIndex;
let blockParamIndex;
if (val.parts && !AST.helpers.scopedId(val) && !val.depth) {

@@ -398,3 +414,3 @@ blockParamIndex = this.blockParamIndex(val.parts[0]);

if (blockParamIndex) {
var blockParamChild = val.parts.slice(1).join('.');
let blockParamChild = val.parts.slice(1).join('.');
this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild);

@@ -417,3 +433,3 @@ } else {

setupFullMustacheParams: function(sexpr, program, inverse, omitEmpty) {
var params = sexpr.params;
let params = sexpr.params;
this.pushParams(params);

@@ -434,4 +450,4 @@

blockParamIndex: function(name) {
for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) {
var blockParams = this.options.blockParams[depth],
for (let depth = 0, len = this.options.blockParams.length; depth < len; depth++) {
let blockParams = this.options.blockParams[depth],
param = blockParams && indexOf(blockParams, name);

@@ -447,3 +463,3 @@ if (blockParams && param >= 0) {

if (input == null || (typeof input !== 'string' && input.type !== 'Program')) {
throw new Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed " + input);
throw new Exception('You must pass a string or Handlebars AST to Handlebars.precompile. You passed ' + input);
}

@@ -459,14 +475,12 @@

var ast = env.parse(input, options);
var environment = new env.Compiler().compile(ast, options);
let ast = env.parse(input, options),
environment = new env.Compiler().compile(ast, options);
return new env.JavaScriptCompiler().compile(environment, options);
}
export function compile(input, options, env) {
export function compile(input, options = {}, env) {
if (input == null || (typeof input !== 'string' && input.type !== 'Program')) {
throw new Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input);
throw new Exception('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input);
}
options = options || {};
if (!('data' in options)) {

@@ -479,8 +493,8 @@ options.data = true;

var compiled;
let compiled;
function compileInput() {
var ast = env.parse(input, options);
var environment = new env.Compiler().compile(ast, options);
var templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true);
let ast = env.parse(input, options),
environment = new env.Compiler().compile(ast, options),
templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true);
return env.template(templateSpec);

@@ -490,13 +504,13 @@ }

// Template is only compiled on first use and cached after that point.
var ret = function(context, options) {
function ret(context, execOptions) {
if (!compiled) {
compiled = compileInput();
}
return compiled.call(this, context, options);
};
ret._setup = function(options) {
return compiled.call(this, context, execOptions);
}
ret._setup = function(setupOptions) {
if (!compiled) {
compiled = compileInput();
}
return compiled._setup(options);
return compiled._setup(setupOptions);
};

@@ -518,3 +532,3 @@ ret._child = function(i, data, blockParams, depths) {

if (isArray(a) && isArray(b) && a.length === b.length) {
for (var i = 0; i < a.length; i++) {
for (let i = 0; i < a.length; i++) {
if (!argEquals(a[i], b[i])) {

@@ -530,7 +544,7 @@ return false;

if (!sexpr.path.parts) {
var literal = sexpr.path;
let literal = sexpr.path;
// Casting to string here to make false and 0 literal values play nicely with the rest
// of the system.
sexpr.path = new AST.PathExpression(false, 0, [literal.original+''], literal.original+'', literal.loc);
sexpr.path = new AST.PathExpression(false, 0, [literal.original + ''], literal.original + '', literal.loc);
}
}

@@ -1,2 +0,2 @@

import Exception from "../exception";
import Exception from '../exception';

@@ -15,6 +15,14 @@ export function SourceLocation(source, locInfo) {

export function id(token) {
if (/^\[.*\]$/.test(token)) {
return token.substr(1, token.length - 2);
} else {
return token;
}
}
export function stripFlags(open, close) {
return {
open: open.charAt(2) === '~',
close: close.charAt(close.length-3) === '~'
close: close.charAt(close.length - 3) === '~'
};

@@ -32,3 +40,3 @@ }

var original = data ? '@' : '',
let original = data ? '@' : '',
dig = [],

@@ -38,7 +46,10 @@ depth = 0,

for(var i=0,l=parts.length; i<l; i++) {
var part = parts[i].part;
for (let i = 0, l = parts.length; i < l; i++) {
let part = parts[i].part,
// If we have [] syntax then we do not treat path references as operators,
// i.e. foo.[this] resolves to approximately context.foo['this']
isLiteral = parts[i].original !== part;
original += (parts[i].separator || '') + part;
if (part === '..' || part === '.' || part === 'this') {
if (!isLiteral && (part === '..' || part === '.' || part === 'this')) {
if (dig.length > 0) {

@@ -61,3 +72,3 @@ throw new Exception('Invalid path: ' + original, {loc: locInfo});

// Must use charAt to support IE pre-10
var escapeFlag = open.charAt(3) || open.charAt(2),
let escapeFlag = open.charAt(3) || open.charAt(2),
escaped = escapeFlag !== '{' && escapeFlag !== '&';

@@ -71,3 +82,3 @@

if (openRawBlock.path.original !== close) {
var errorNode = {loc: openRawBlock.path.loc};
let errorNode = {loc: openRawBlock.path.loc};

@@ -78,3 +89,3 @@ throw new Exception(openRawBlock.path.original + " doesn't match " + close, errorNode);

locInfo = this.locInfo(locInfo);
var program = new this.Program([content], null, {}, locInfo);
let program = new this.Program([content], null, {}, locInfo);

@@ -92,3 +103,3 @@ return new this.BlockStatement(

if (close && close.path && openBlock.path.original !== close.path.original) {
var errorNode = {loc: openBlock.path.loc};
let errorNode = {loc: openBlock.path.loc};

@@ -100,3 +111,3 @@ throw new Exception(openBlock.path.original + ' doesn\'t match ' + close.path.original, errorNode);

var inverse,
let inverse,
inverseStrip;

@@ -103,0 +114,0 @@

@@ -1,5 +0,5 @@

import { COMPILER_REVISION, REVISION_CHANGES } from "../base";
import Exception from "../exception";
import {isArray} from "../utils";
import CodeGen from "./code-gen";
import { COMPILER_REVISION, REVISION_CHANGES } from '../base';
import Exception from '../exception';
import {isArray} from '../utils';
import CodeGen from './code-gen';

@@ -17,3 +17,3 @@ function Literal(value) {

if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
return [parent, ".", name];
return [parent, '.', name];
} else {

@@ -28,4 +28,4 @@ return [parent, "['", name, "']"];

compilerInfo: function() {
var revision = COMPILER_REVISION,
versions = REVISION_CHANGES[revision];
const revision = COMPILER_REVISION,
versions = REVISION_CHANGES[revision];
return [revision, versions];

@@ -55,3 +55,3 @@ },

initializeBuffer: function() {
return this.quotedString("");
return this.quotedString('');
},

@@ -90,3 +90,3 @@ // END PUBLIC API

var opcodes = environment.opcodes,
let opcodes = environment.opcodes,
opcode,

@@ -114,9 +114,9 @@ firstLoc,

var fn = this.createFunctionContext(asObject);
let fn = this.createFunctionContext(asObject);
if (!this.isChild) {
var ret = {
let ret = {
compiler: this.compilerInfo(),
main: fn
};
var programs = this.context.programs;
let programs = this.context.programs;
for (i = 0, l = programs.length; i < l; i++) {

@@ -174,7 +174,7 @@ if (programs[i]) {

createFunctionContext: function(asObject) {
var varDeclarations = '';
let varDeclarations = '';
var locals = this.stackVars.concat(this.registers.list);
if(locals.length > 0) {
varDeclarations += ", " + locals.join(", ");
let locals = this.stackVars.concat(this.registers.list);
if (locals.length > 0) {
varDeclarations += ', ' + locals.join(', ');
}

@@ -188,5 +188,5 @@

// we aren't concern about minimizing the template size.
var aliasCount = 0;
for (var alias in this.aliases) {
var node = this.aliases[alias];
let aliasCount = 0;
for (let alias in this.aliases) { // eslint-disable-line guard-for-in
let node = this.aliases[alias];

@@ -199,3 +199,3 @@ if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) {

var params = ["depth0", "helpers", "partials", "data"];
let params = ['depth0', 'helpers', 'partials', 'data'];

@@ -210,3 +210,3 @@ if (this.useBlockParams || this.useDepths) {

// Perform a second pass over the output to merge content when possible
var source = this.mergeSource(varDeclarations);
let source = this.mergeSource(varDeclarations);

@@ -222,3 +222,3 @@ if (asObject) {

mergeSource: function(varDeclarations) {
var isSimple = this.environment.isSimple,
let isSimple = this.environment.isSimple,
appendOnly = !this.forceBuffer,

@@ -230,3 +230,3 @@ appendFirst,

bufferEnd;
this.source.each(function(line) {
this.source.each((line) => {
if (line.appendToBuffer) {

@@ -266,3 +266,3 @@ if (bufferStart) {

} else {
varDeclarations += ", buffer = " + (appendFirst ? '' : this.initializeBuffer());
varDeclarations += ', buffer = ' + (appendFirst ? '' : this.initializeBuffer());

@@ -294,7 +294,7 @@ if (bufferStart) {

blockValue: function(name) {
var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'),
let blockHelperMissing = this.aliasable('helpers.blockHelperMissing'),
params = [this.contextName(0)];
this.setupHelperArgs(name, 0, params);
var blockName = this.popStack();
let blockName = this.popStack();
params.splice(1, 0, blockName);

@@ -313,3 +313,3 @@

// We're being a bit cheeky and reusing the options value from the prior exec
var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'),
let blockHelperMissing = this.aliasable('helpers.blockHelperMissing'),
params = [this.contextName(0)];

@@ -320,3 +320,3 @@ this.setupHelperArgs('', 0, params, true);

var current = this.topStack();
let current = this.topStack();
params.splice(1, 0, current);

@@ -357,9 +357,7 @@

if (this.isInline()) {
this.replaceStack(function(current) {
return [' != null ? ', current, ' : ""'];
});
this.replaceStack((current) => [' != null ? ', current, ' : ""']);
this.pushSource(this.appendToBuffer(this.popStack()));
} else {
var local = this.popStack();
let local = this.popStack();
this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']);

@@ -412,3 +410,3 @@ if (this.environment.isSimple) {

lookupOnContext: function(parts, falsy, scoped) {
var i = 0;
let i = 0;

@@ -464,6 +462,7 @@ if (!scoped && this.options.compat && !this.lastContext) {

var len = parts.length;
let len = parts.length;
for (; i < len; i++) {
this.replaceStack(function(current) {
var lookup = this.nameLookup(current, parts[i], type);
/*eslint-disable no-loop-func */
this.replaceStack((current) => {
let lookup = this.nameLookup(current, parts[i], type);
// We want to ensure that zero and false are handled properly if the context (falsy flag)

@@ -478,2 +477,3 @@ // needs to have the special handling for these values.

});
/*eslint-enable no-loop-func */
}

@@ -533,3 +533,3 @@ },

popHash: function() {
var hash = this.hash;
let hash = this.hash;
this.hash = this.hashes.pop();

@@ -596,7 +596,7 @@

invokeHelper: function(paramSize, name, isSimple) {
var nonHelper = this.popStack();
var helper = this.setupHelper(paramSize, name);
var simple = isSimple ? [helper.name, ' || '] : '';
let nonHelper = this.popStack(),
helper = this.setupHelper(paramSize, name),
simple = isSimple ? [helper.name, ' || '] : '';
var lookup = ['('].concat(simple, nonHelper);
let lookup = ['('].concat(simple, nonHelper);
if (!this.options.strict) {

@@ -618,3 +618,3 @@ lookup.push(' || ', this.aliasable('helpers.helperMissing'));

invokeKnownHelper: function(paramSize, name) {
var helper = this.setupHelper(paramSize, name);
let helper = this.setupHelper(paramSize, name);
this.push(this.source.functionCall(helper.name, 'call', helper.callParams));

@@ -638,10 +638,10 @@ },

var nonHelper = this.popStack();
let nonHelper = this.popStack();
this.emptyHash();
var helper = this.setupHelper(0, name, helperCall);
let helper = this.setupHelper(0, name, helperCall);
var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper');
let helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper');
var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')'];
let lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')'];
if (!this.options.strict) {

@@ -659,3 +659,3 @@ lookup[0] = '(helper = ';

'(typeof helper === ', this.aliasable('"function"'), ' ? ',
this.source.functionCall('helper','call', helper.callParams), ' : helper))'
this.source.functionCall('helper', 'call', helper.callParams), ' : helper))'
]);

@@ -672,3 +672,3 @@ },

invokePartial: function(isDynamic, name, indent) {
var params = [],
let params = [],
options = this.setupParams(name, 1, params, false);

@@ -709,3 +709,3 @@

assignToHash: function(key) {
var value = this.popStack(),
let value = this.popStack(),
context,

@@ -723,3 +723,3 @@ type,

var hash = this.hash;
let hash = this.hash;
if (context) {

@@ -756,9 +756,9 @@ hash.contexts[key] = context;

compileChildren: function(environment, options) {
var children = environment.children, child, compiler;
let children = environment.children, child, compiler;
for(var i=0, l=children.length; i<l; i++) {
for (let i = 0, l = children.length; i < l; i++) {
child = children[i];
compiler = new this.compiler();
compiler = new this.compiler(); // eslint-disable-line new-cap
var index = this.matchExistingProgram(child);
let index = this.matchExistingProgram(child);

@@ -785,4 +785,4 @@ if (index == null) {

matchExistingProgram: function(child) {
for (var i = 0, len = this.context.environments.length; i < len; i++) {
var environment = this.context.environments[i];
for (let i = 0, len = this.context.environments.length; i < len; i++) {
let environment = this.context.environments[i];
if (environment && environment.equals(child)) {

@@ -795,3 +795,3 @@ return i;

programExpression: function(guid) {
var child = this.environment.children[guid],
let child = this.environment.children[guid],
programParams = [child.index, 'data', child.blockParams];

@@ -810,3 +810,3 @@

useRegister: function(name) {
if(!this.registers[name]) {
if (!this.registers[name]) {
this.registers[name] = true;

@@ -843,3 +843,3 @@ this.registers.list.push(name);

replaceStack: function(callback) {
var prefix = ['('],
let prefix = ['('],
stack,

@@ -855,3 +855,3 @@ createdStack,

// We want to merge the inline statement into the replacement statement via ','
var top = this.popStack(true);
let top = this.popStack(true);

@@ -866,3 +866,3 @@ if (top instanceof Literal) {

createdStack = true;
var name = this.incrStack();
let name = this.incrStack();

@@ -873,3 +873,3 @@ prefix = ['((', this.push(name), ' = ', top, ')'];

var item = callback.call(this, stack);
let item = callback.call(this, stack);

@@ -887,13 +887,13 @@ if (!usedLiteral) {

this.stackSlot++;
if(this.stackSlot > this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); }
if (this.stackSlot > this.stackVars.length) { this.stackVars.push('stack' + this.stackSlot); }
return this.topStackName();
},
topStackName: function() {
return "stack" + this.stackSlot;
return 'stack' + this.stackSlot;
},
flushInline: function() {
var inlineStack = this.inlineStack;
let inlineStack = this.inlineStack;
this.inlineStack = [];
for (var i = 0, len = inlineStack.length; i < len; i++) {
var entry = inlineStack[i];
for (let i = 0, len = inlineStack.length; i < len; i++) {
let entry = inlineStack[i];
/* istanbul ignore if */

@@ -903,3 +903,3 @@ if (entry instanceof Literal) {

} else {
var stack = this.incrStack();
let stack = this.incrStack();
this.pushSource([stack, ' = ', entry, ';']);

@@ -915,3 +915,3 @@ this.compileStack.push(stack);

popStack: function(wrapped) {
var inline = this.isInline(),
let inline = this.isInline(),
item = (inline ? this.inlineStack : this.compileStack).pop();

@@ -934,3 +934,3 @@

topStack: function() {
var stack = (this.isInline() ? this.inlineStack : this.compileStack),
let stack = (this.isInline() ? this.inlineStack : this.compileStack),
item = stack[stack.length - 1];

@@ -963,3 +963,3 @@

aliasable: function(name) {
var ret = this.aliases[name];
let ret = this.aliases[name];
if (ret) {

@@ -978,5 +978,5 @@ ret.referenceCount++;

setupHelper: function(paramSize, name, blockHelper) {
var params = [],
let params = [],
paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper);
var foundHelper = this.nameLookup('helpers', name, 'helper');
let foundHelper = this.nameLookup('helpers', name, 'helper');

@@ -992,3 +992,3 @@ return {

setupParams: function(helper, paramSize, params) {
var options = {}, contexts = [], types = [], ids = [], param;
let options = {}, contexts = [], types = [], ids = [], param;

@@ -1006,3 +1006,3 @@ options.name = this.quotedString(helper);

var inverse = this.popStack(),
let inverse = this.popStack(),
program = this.popStack();

@@ -1019,3 +1019,3 @@

// so we need to pop them off the stack in reverse order
var i = paramSize;
let i = paramSize;
while (i--) {

@@ -1052,3 +1052,3 @@ param = this.popStack();

setupHelperArgs: function(helper, paramSize, params, useRegister) {
var options = this.setupParams(helper, paramSize, params, true);
let options = this.setupParams(helper, paramSize, params, true);
options = this.objectLiteral(options);

@@ -1067,35 +1067,36 @@ if (useRegister) {

var reservedWords = (
"break else new var" +
" case finally return void" +
" catch for switch while" +
" continue function this with" +
" default if throw" +
" delete in try" +
" do instanceof typeof" +
" abstract enum int short" +
" boolean export interface static" +
" byte extends long super" +
" char final native synchronized" +
" class float package throws" +
" const goto private transient" +
" debugger implements protected volatile" +
" double import public let yield await" +
" null true false"
).split(" ");
(function() {
const reservedWords = (
'break else new var' +
' case finally return void' +
' catch for switch while' +
' continue function this with' +
' default if throw' +
' delete in try' +
' do instanceof typeof' +
' abstract enum int short' +
' boolean export interface static' +
' byte extends long super' +
' char final native synchronized' +
' class float package throws' +
' const goto private transient' +
' debugger implements protected volatile' +
' double import public let yield await' +
' null true false'
).split(' ');
var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};
const compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};
for(var i=0, l=reservedWords.length; i<l; i++) {
compilerWords[reservedWords[i]] = true;
}
for (let i = 0, l = reservedWords.length; i < l; i++) {
compilerWords[reservedWords[i]] = true;
}
}());
JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name);
return !JavaScriptCompiler.RESERVED_WORDS[name] && (/^[a-zA-Z_$][0-9a-zA-Z_$]*$/).test(name);
};
function strictLookup(requireTerminal, compiler, parts, type) {
var stack = compiler.popStack();
var i = 0,
let stack = compiler.popStack(),
i = 0,
len = parts.length;

@@ -1102,0 +1103,0 @@ if (requireTerminal) {

@@ -7,5 +7,5 @@ /* jshint ignore:start */

yy: {},
symbols_: {"error":2,"root":3,"program":4,"EOF":5,"program_repetition0":6,"statement":7,"mustache":8,"block":9,"rawBlock":10,"partial":11,"content":12,"COMMENT":13,"CONTENT":14,"openRawBlock":15,"END_RAW_BLOCK":16,"OPEN_RAW_BLOCK":17,"helperName":18,"openRawBlock_repetition0":19,"openRawBlock_option0":20,"CLOSE_RAW_BLOCK":21,"openBlock":22,"block_option0":23,"closeBlock":24,"openInverse":25,"block_option1":26,"OPEN_BLOCK":27,"openBlock_repetition0":28,"openBlock_option0":29,"openBlock_option1":30,"CLOSE":31,"OPEN_INVERSE":32,"openInverse_repetition0":33,"openInverse_option0":34,"openInverse_option1":35,"openInverseChain":36,"OPEN_INVERSE_CHAIN":37,"openInverseChain_repetition0":38,"openInverseChain_option0":39,"openInverseChain_option1":40,"inverseAndProgram":41,"INVERSE":42,"inverseChain":43,"inverseChain_option0":44,"OPEN_ENDBLOCK":45,"OPEN":46,"mustache_repetition0":47,"mustache_option0":48,"OPEN_UNESCAPED":49,"mustache_repetition1":50,"mustache_option1":51,"CLOSE_UNESCAPED":52,"OPEN_PARTIAL":53,"partialName":54,"partial_repetition0":55,"partial_option0":56,"param":57,"sexpr":58,"OPEN_SEXPR":59,"sexpr_repetition0":60,"sexpr_option0":61,"CLOSE_SEXPR":62,"hash":63,"hash_repetition_plus0":64,"hashSegment":65,"ID":66,"EQUALS":67,"blockParams":68,"OPEN_BLOCK_PARAMS":69,"blockParams_repetition_plus0":70,"CLOSE_BLOCK_PARAMS":71,"path":72,"dataName":73,"STRING":74,"NUMBER":75,"BOOLEAN":76,"DATA":77,"pathSegments":78,"SEP":79,"$accept":0,"$end":1},
terminals_: {2:"error",5:"EOF",13:"COMMENT",14:"CONTENT",16:"END_RAW_BLOCK",17:"OPEN_RAW_BLOCK",21:"CLOSE_RAW_BLOCK",27:"OPEN_BLOCK",31:"CLOSE",32:"OPEN_INVERSE",37:"OPEN_INVERSE_CHAIN",42:"INVERSE",45:"OPEN_ENDBLOCK",46:"OPEN",49:"OPEN_UNESCAPED",52:"CLOSE_UNESCAPED",53:"OPEN_PARTIAL",59:"OPEN_SEXPR",62:"CLOSE_SEXPR",66:"ID",67:"EQUALS",69:"OPEN_BLOCK_PARAMS",71:"CLOSE_BLOCK_PARAMS",74:"STRING",75:"NUMBER",76:"BOOLEAN",77:"DATA",79:"SEP"},
productions_: [0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[12,1],[10,3],[15,5],[9,4],[9,4],[22,6],[25,6],[36,6],[41,2],[43,3],[43,1],[24,3],[8,5],[8,5],[11,5],[57,1],[57,1],[58,5],[63,1],[65,3],[68,3],[18,1],[18,1],[18,1],[18,1],[18,1],[54,1],[54,1],[73,2],[72,1],[78,3],[78,1],[6,0],[6,2],[19,0],[19,2],[20,0],[20,1],[23,0],[23,1],[26,0],[26,1],[28,0],[28,2],[29,0],[29,1],[30,0],[30,1],[33,0],[33,2],[34,0],[34,1],[35,0],[35,1],[38,0],[38,2],[39,0],[39,1],[40,0],[40,1],[44,0],[44,1],[47,0],[47,2],[48,0],[48,1],[50,0],[50,2],[51,0],[51,1],[55,0],[55,2],[56,0],[56,1],[60,0],[60,2],[61,0],[61,1],[64,1],[64,2],[70,1],[70,2]],
symbols_: {"error":2,"root":3,"program":4,"EOF":5,"program_repetition0":6,"statement":7,"mustache":8,"block":9,"rawBlock":10,"partial":11,"content":12,"COMMENT":13,"CONTENT":14,"openRawBlock":15,"END_RAW_BLOCK":16,"OPEN_RAW_BLOCK":17,"helperName":18,"openRawBlock_repetition0":19,"openRawBlock_option0":20,"CLOSE_RAW_BLOCK":21,"openBlock":22,"block_option0":23,"closeBlock":24,"openInverse":25,"block_option1":26,"OPEN_BLOCK":27,"openBlock_repetition0":28,"openBlock_option0":29,"openBlock_option1":30,"CLOSE":31,"OPEN_INVERSE":32,"openInverse_repetition0":33,"openInverse_option0":34,"openInverse_option1":35,"openInverseChain":36,"OPEN_INVERSE_CHAIN":37,"openInverseChain_repetition0":38,"openInverseChain_option0":39,"openInverseChain_option1":40,"inverseAndProgram":41,"INVERSE":42,"inverseChain":43,"inverseChain_option0":44,"OPEN_ENDBLOCK":45,"OPEN":46,"mustache_repetition0":47,"mustache_option0":48,"OPEN_UNESCAPED":49,"mustache_repetition1":50,"mustache_option1":51,"CLOSE_UNESCAPED":52,"OPEN_PARTIAL":53,"partialName":54,"partial_repetition0":55,"partial_option0":56,"param":57,"sexpr":58,"OPEN_SEXPR":59,"sexpr_repetition0":60,"sexpr_option0":61,"CLOSE_SEXPR":62,"hash":63,"hash_repetition_plus0":64,"hashSegment":65,"ID":66,"EQUALS":67,"blockParams":68,"OPEN_BLOCK_PARAMS":69,"blockParams_repetition_plus0":70,"CLOSE_BLOCK_PARAMS":71,"path":72,"dataName":73,"STRING":74,"NUMBER":75,"BOOLEAN":76,"UNDEFINED":77,"NULL":78,"DATA":79,"pathSegments":80,"SEP":81,"$accept":0,"$end":1},
terminals_: {2:"error",5:"EOF",13:"COMMENT",14:"CONTENT",16:"END_RAW_BLOCK",17:"OPEN_RAW_BLOCK",21:"CLOSE_RAW_BLOCK",27:"OPEN_BLOCK",31:"CLOSE",32:"OPEN_INVERSE",37:"OPEN_INVERSE_CHAIN",42:"INVERSE",45:"OPEN_ENDBLOCK",46:"OPEN",49:"OPEN_UNESCAPED",52:"CLOSE_UNESCAPED",53:"OPEN_PARTIAL",59:"OPEN_SEXPR",62:"CLOSE_SEXPR",66:"ID",67:"EQUALS",69:"OPEN_BLOCK_PARAMS",71:"CLOSE_BLOCK_PARAMS",74:"STRING",75:"NUMBER",76:"BOOLEAN",77:"UNDEFINED",78:"NULL",79:"DATA",81:"SEP"},
productions_: [0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[12,1],[10,3],[15,5],[9,4],[9,4],[22,6],[25,6],[36,6],[41,2],[43,3],[43,1],[24,3],[8,5],[8,5],[11,5],[57,1],[57,1],[58,5],[63,1],[65,3],[68,3],[18,1],[18,1],[18,1],[18,1],[18,1],[18,1],[18,1],[54,1],[54,1],[73,2],[72,1],[80,3],[80,1],[6,0],[6,2],[19,0],[19,2],[20,0],[20,1],[23,0],[23,1],[26,0],[26,1],[28,0],[28,2],[29,0],[29,1],[30,0],[30,1],[33,0],[33,2],[34,0],[34,1],[35,0],[35,1],[38,0],[38,2],[39,0],[39,1],[40,0],[40,1],[44,0],[44,1],[47,0],[47,2],[48,0],[48,1],[50,0],[50,2],[51,0],[51,1],[55,0],[55,2],[56,0],[56,1],[60,0],[60,2],[61,0],[61,1],[64,1],[64,2],[70,1],[70,2]],
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {

@@ -75,5 +75,5 @@

break;
case 28:this.$ = new yy.HashPair($$[$0-2], $$[$0], yy.locInfo(this._$));
case 28:this.$ = new yy.HashPair(yy.id($$[$0-2]), $$[$0], yy.locInfo(this._$));
break;
case 29:this.$ = $$[$0-1];
case 29:this.$ = yy.id($$[$0-1]);
break;

@@ -90,17 +90,17 @@ case 30:this.$ = $$[$0];

break;
case 35:this.$ = $$[$0];
case 35:this.$ = new yy.UndefinedLiteral(yy.locInfo(this._$));
break;
case 36:this.$ = $$[$0];
case 36:this.$ = new yy.NullLiteral(yy.locInfo(this._$));
break;
case 37:this.$ = yy.preparePath(true, $$[$0], this._$);
case 37:this.$ = $$[$0];
break;
case 38:this.$ = yy.preparePath(false, $$[$0], this._$);
case 38:this.$ = $$[$0];
break;
case 39: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2];
case 39:this.$ = yy.preparePath(true, $$[$0], this._$);
break;
case 40:this.$ = [{part: $$[$0]}];
case 40:this.$ = yy.preparePath(false, $$[$0], this._$);
break;
case 41:this.$ = [];
case 41: $$[$0-2].push({part: yy.id($$[$0]), original: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2];
break;
case 42:$$[$0-1].push($$[$0]);
case 42:this.$ = [{part: yy.id($$[$0]), original: $$[$0]}];
break;

@@ -111,33 +111,33 @@ case 43:this.$ = [];

break;
case 51:this.$ = [];
case 45:this.$ = [];
break;
case 52:$$[$0-1].push($$[$0]);
case 46:$$[$0-1].push($$[$0]);
break;
case 57:this.$ = [];
case 53:this.$ = [];
break;
case 58:$$[$0-1].push($$[$0]);
case 54:$$[$0-1].push($$[$0]);
break;
case 63:this.$ = [];
case 59:this.$ = [];
break;
case 64:$$[$0-1].push($$[$0]);
case 60:$$[$0-1].push($$[$0]);
break;
case 71:this.$ = [];
case 65:this.$ = [];
break;
case 72:$$[$0-1].push($$[$0]);
case 66:$$[$0-1].push($$[$0]);
break;
case 75:this.$ = [];
case 73:this.$ = [];
break;
case 76:$$[$0-1].push($$[$0]);
case 74:$$[$0-1].push($$[$0]);
break;
case 79:this.$ = [];
case 77:this.$ = [];
break;
case 80:$$[$0-1].push($$[$0]);
case 78:$$[$0-1].push($$[$0]);
break;
case 83:this.$ = [];
case 81:this.$ = [];
break;
case 84:$$[$0-1].push($$[$0]);
case 82:$$[$0-1].push($$[$0]);
break;
case 87:this.$ = [$$[$0]];
case 85:this.$ = [];
break;
case 88:$$[$0-1].push($$[$0]);
case 86:$$[$0-1].push($$[$0]);
break;

@@ -148,6 +148,10 @@ case 89:this.$ = [$$[$0]];

break;
case 91:this.$ = [$$[$0]];
break;
case 92:$$[$0-1].push($$[$0]);
break;
}
},
table: [{3:1,4:2,5:[2,41],6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],46:[2,41],49:[2,41],53:[2,41]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:[1,11],14:[1,18],15:16,17:[1,21],22:14,25:15,27:[1,19],32:[1,20],37:[2,2],42:[2,2],45:[2,2],46:[1,12],49:[1,13],53:[1,17]},{1:[2,1]},{5:[2,42],13:[2,42],14:[2,42],17:[2,42],27:[2,42],32:[2,42],37:[2,42],42:[2,42],45:[2,42],46:[2,42],49:[2,42],53:[2,42]},{5:[2,3],13:[2,3],14:[2,3],17:[2,3],27:[2,3],32:[2,3],37:[2,3],42:[2,3],45:[2,3],46:[2,3],49:[2,3],53:[2,3]},{5:[2,4],13:[2,4],14:[2,4],17:[2,4],27:[2,4],32:[2,4],37:[2,4],42:[2,4],45:[2,4],46:[2,4],49:[2,4],53:[2,4]},{5:[2,5],13:[2,5],14:[2,5],17:[2,5],27:[2,5],32:[2,5],37:[2,5],42:[2,5],45:[2,5],46:[2,5],49:[2,5],53:[2,5]},{5:[2,6],13:[2,6],14:[2,6],17:[2,6],27:[2,6],32:[2,6],37:[2,6],42:[2,6],45:[2,6],46:[2,6],49:[2,6],53:[2,6]},{5:[2,7],13:[2,7],14:[2,7],17:[2,7],27:[2,7],32:[2,7],37:[2,7],42:[2,7],45:[2,7],46:[2,7],49:[2,7],53:[2,7]},{5:[2,8],13:[2,8],14:[2,8],17:[2,8],27:[2,8],32:[2,8],37:[2,8],42:[2,8],45:[2,8],46:[2,8],49:[2,8],53:[2,8]},{18:22,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:31,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{4:32,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],37:[2,41],42:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{4:33,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],42:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{12:34,14:[1,18]},{18:36,54:35,58:37,59:[1,38],66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{5:[2,9],13:[2,9],14:[2,9],16:[2,9],17:[2,9],27:[2,9],32:[2,9],37:[2,9],42:[2,9],45:[2,9],46:[2,9],49:[2,9],53:[2,9]},{18:39,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:40,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:41,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{31:[2,71],47:42,59:[2,71],66:[2,71],74:[2,71],75:[2,71],76:[2,71],77:[2,71]},{21:[2,30],31:[2,30],52:[2,30],59:[2,30],62:[2,30],66:[2,30],69:[2,30],74:[2,30],75:[2,30],76:[2,30],77:[2,30]},{21:[2,31],31:[2,31],52:[2,31],59:[2,31],62:[2,31],66:[2,31],69:[2,31],74:[2,31],75:[2,31],76:[2,31],77:[2,31]},{21:[2,32],31:[2,32],52:[2,32],59:[2,32],62:[2,32],66:[2,32],69:[2,32],74:[2,32],75:[2,32],76:[2,32],77:[2,32]},{21:[2,33],31:[2,33],52:[2,33],59:[2,33],62:[2,33],66:[2,33],69:[2,33],74:[2,33],75:[2,33],76:[2,33],77:[2,33]},{21:[2,34],31:[2,34],52:[2,34],59:[2,34],62:[2,34],66:[2,34],69:[2,34],74:[2,34],75:[2,34],76:[2,34],77:[2,34]},{21:[2,38],31:[2,38],52:[2,38],59:[2,38],62:[2,38],66:[2,38],69:[2,38],74:[2,38],75:[2,38],76:[2,38],77:[2,38],79:[1,43]},{66:[1,30],78:44},{21:[2,40],31:[2,40],52:[2,40],59:[2,40],62:[2,40],66:[2,40],69:[2,40],74:[2,40],75:[2,40],76:[2,40],77:[2,40],79:[2,40]},{50:45,52:[2,75],59:[2,75],66:[2,75],74:[2,75],75:[2,75],76:[2,75],77:[2,75]},{23:46,36:48,37:[1,50],41:49,42:[1,51],43:47,45:[2,47]},{26:52,41:53,42:[1,51],45:[2,49]},{16:[1,54]},{31:[2,79],55:55,59:[2,79],66:[2,79],74:[2,79],75:[2,79],76:[2,79],77:[2,79]},{31:[2,35],59:[2,35],66:[2,35],74:[2,35],75:[2,35],76:[2,35],77:[2,35]},{31:[2,36],59:[2,36],66:[2,36],74:[2,36],75:[2,36],76:[2,36],77:[2,36]},{18:56,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{28:57,31:[2,51],59:[2,51],66:[2,51],69:[2,51],74:[2,51],75:[2,51],76:[2,51],77:[2,51]},{31:[2,57],33:58,59:[2,57],66:[2,57],69:[2,57],74:[2,57],75:[2,57],76:[2,57],77:[2,57]},{19:59,21:[2,43],59:[2,43],66:[2,43],74:[2,43],75:[2,43],76:[2,43],77:[2,43]},{18:63,31:[2,73],48:60,57:61,58:64,59:[1,38],63:62,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{66:[1,68]},{21:[2,37],31:[2,37],52:[2,37],59:[2,37],62:[2,37],66:[2,37],69:[2,37],74:[2,37],75:[2,37],76:[2,37],77:[2,37],79:[1,43]},{18:63,51:69,52:[2,77],57:70,58:64,59:[1,38],63:71,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{24:72,45:[1,73]},{45:[2,48]},{4:74,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],37:[2,41],42:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{45:[2,19]},{18:75,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{4:76,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{24:77,45:[1,73]},{45:[2,50]},{5:[2,10],13:[2,10],14:[2,10],17:[2,10],27:[2,10],32:[2,10],37:[2,10],42:[2,10],45:[2,10],46:[2,10],49:[2,10],53:[2,10]},{18:63,31:[2,81],56:78,57:79,58:64,59:[1,38],63:80,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{59:[2,83],60:81,62:[2,83],66:[2,83],74:[2,83],75:[2,83],76:[2,83],77:[2,83]},{18:63,29:82,31:[2,53],57:83,58:64,59:[1,38],63:84,64:65,65:66,66:[1,67],69:[2,53],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:63,31:[2,59],34:85,57:86,58:64,59:[1,38],63:87,64:65,65:66,66:[1,67],69:[2,59],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:63,20:88,21:[2,45],57:89,58:64,59:[1,38],63:90,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{31:[1,91]},{31:[2,72],59:[2,72],66:[2,72],74:[2,72],75:[2,72],76:[2,72],77:[2,72]},{31:[2,74]},{21:[2,24],31:[2,24],52:[2,24],59:[2,24],62:[2,24],66:[2,24],69:[2,24],74:[2,24],75:[2,24],76:[2,24],77:[2,24]},{21:[2,25],31:[2,25],52:[2,25],59:[2,25],62:[2,25],66:[2,25],69:[2,25],74:[2,25],75:[2,25],76:[2,25],77:[2,25]},{21:[2,27],31:[2,27],52:[2,27],62:[2,27],65:92,66:[1,93],69:[2,27]},{21:[2,87],31:[2,87],52:[2,87],62:[2,87],66:[2,87],69:[2,87]},{21:[2,40],31:[2,40],52:[2,40],59:[2,40],62:[2,40],66:[2,40],67:[1,94],69:[2,40],74:[2,40],75:[2,40],76:[2,40],77:[2,40],79:[2,40]},{21:[2,39],31:[2,39],52:[2,39],59:[2,39],62:[2,39],66:[2,39],69:[2,39],74:[2,39],75:[2,39],76:[2,39],77:[2,39],79:[2,39]},{52:[1,95]},{52:[2,76],59:[2,76],66:[2,76],74:[2,76],75:[2,76],76:[2,76],77:[2,76]},{52:[2,78]},{5:[2,12],13:[2,12],14:[2,12],17:[2,12],27:[2,12],32:[2,12],37:[2,12],42:[2,12],45:[2,12],46:[2,12],49:[2,12],53:[2,12]},{18:96,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{36:48,37:[1,50],41:49,42:[1,51],43:98,44:97,45:[2,69]},{31:[2,63],38:99,59:[2,63],66:[2,63],69:[2,63],74:[2,63],75:[2,63],76:[2,63],77:[2,63]},{45:[2,17]},{5:[2,13],13:[2,13],14:[2,13],17:[2,13],27:[2,13],32:[2,13],37:[2,13],42:[2,13],45:[2,13],46:[2,13],49:[2,13],53:[2,13]},{31:[1,100]},{31:[2,80],59:[2,80],66:[2,80],74:[2,80],75:[2,80],76:[2,80],77:[2,80]},{31:[2,82]},{18:63,57:102,58:64,59:[1,38],61:101,62:[2,85],63:103,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{30:104,31:[2,55],68:105,69:[1,106]},{31:[2,52],59:[2,52],66:[2,52],69:[2,52],74:[2,52],75:[2,52],76:[2,52],77:[2,52]},{31:[2,54],69:[2,54]},{31:[2,61],35:107,68:108,69:[1,106]},{31:[2,58],59:[2,58],66:[2,58],69:[2,58],74:[2,58],75:[2,58],76:[2,58],77:[2,58]},{31:[2,60],69:[2,60]},{21:[1,109]},{21:[2,44],59:[2,44],66:[2,44],74:[2,44],75:[2,44],76:[2,44],77:[2,44]},{21:[2,46]},{5:[2,21],13:[2,21],14:[2,21],17:[2,21],27:[2,21],32:[2,21],37:[2,21],42:[2,21],45:[2,21],46:[2,21],49:[2,21],53:[2,21]},{21:[2,88],31:[2,88],52:[2,88],62:[2,88],66:[2,88],69:[2,88]},{67:[1,94]},{18:63,57:110,58:64,59:[1,38],66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{5:[2,22],13:[2,22],14:[2,22],17:[2,22],27:[2,22],32:[2,22],37:[2,22],42:[2,22],45:[2,22],46:[2,22],49:[2,22],53:[2,22]},{31:[1,111]},{45:[2,18]},{45:[2,70]},{18:63,31:[2,65],39:112,57:113,58:64,59:[1,38],63:114,64:65,65:66,66:[1,67],69:[2,65],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{5:[2,23],13:[2,23],14:[2,23],17:[2,23],27:[2,23],32:[2,23],37:[2,23],42:[2,23],45:[2,23],46:[2,23],49:[2,23],53:[2,23]},{62:[1,115]},{59:[2,84],62:[2,84],66:[2,84],74:[2,84],75:[2,84],76:[2,84],77:[2,84]},{62:[2,86]},{31:[1,116]},{31:[2,56]},{66:[1,118],70:117},{31:[1,119]},{31:[2,62]},{14:[2,11]},{21:[2,28],31:[2,28],52:[2,28],62:[2,28],66:[2,28],69:[2,28]},{5:[2,20],13:[2,20],14:[2,20],17:[2,20],27:[2,20],32:[2,20],37:[2,20],42:[2,20],45:[2,20],46:[2,20],49:[2,20],53:[2,20]},{31:[2,67],40:120,68:121,69:[1,106]},{31:[2,64],59:[2,64],66:[2,64],69:[2,64],74:[2,64],75:[2,64],76:[2,64],77:[2,64]},{31:[2,66],69:[2,66]},{21:[2,26],31:[2,26],52:[2,26],59:[2,26],62:[2,26],66:[2,26],69:[2,26],74:[2,26],75:[2,26],76:[2,26],77:[2,26]},{13:[2,14],14:[2,14],17:[2,14],27:[2,14],32:[2,14],37:[2,14],42:[2,14],45:[2,14],46:[2,14],49:[2,14],53:[2,14]},{66:[1,123],71:[1,122]},{66:[2,89],71:[2,89]},{13:[2,15],14:[2,15],17:[2,15],27:[2,15],32:[2,15],42:[2,15],45:[2,15],46:[2,15],49:[2,15],53:[2,15]},{31:[1,124]},{31:[2,68]},{31:[2,29]},{66:[2,90],71:[2,90]},{13:[2,16],14:[2,16],17:[2,16],27:[2,16],32:[2,16],37:[2,16],42:[2,16],45:[2,16],46:[2,16],49:[2,16],53:[2,16]}],
defaultActions: {4:[2,1],47:[2,48],49:[2,19],53:[2,50],62:[2,74],71:[2,78],76:[2,17],80:[2,82],90:[2,46],97:[2,18],98:[2,70],103:[2,86],105:[2,56],108:[2,62],109:[2,11],121:[2,68],122:[2,29]},
table: [{3:1,4:2,5:[2,43],6:3,13:[2,43],14:[2,43],17:[2,43],27:[2,43],32:[2,43],46:[2,43],49:[2,43],53:[2,43]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:[1,11],14:[1,18],15:16,17:[1,21],22:14,25:15,27:[1,19],32:[1,20],37:[2,2],42:[2,2],45:[2,2],46:[1,12],49:[1,13],53:[1,17]},{1:[2,1]},{5:[2,44],13:[2,44],14:[2,44],17:[2,44],27:[2,44],32:[2,44],37:[2,44],42:[2,44],45:[2,44],46:[2,44],49:[2,44],53:[2,44]},{5:[2,3],13:[2,3],14:[2,3],17:[2,3],27:[2,3],32:[2,3],37:[2,3],42:[2,3],45:[2,3],46:[2,3],49:[2,3],53:[2,3]},{5:[2,4],13:[2,4],14:[2,4],17:[2,4],27:[2,4],32:[2,4],37:[2,4],42:[2,4],45:[2,4],46:[2,4],49:[2,4],53:[2,4]},{5:[2,5],13:[2,5],14:[2,5],17:[2,5],27:[2,5],32:[2,5],37:[2,5],42:[2,5],45:[2,5],46:[2,5],49:[2,5],53:[2,5]},{5:[2,6],13:[2,6],14:[2,6],17:[2,6],27:[2,6],32:[2,6],37:[2,6],42:[2,6],45:[2,6],46:[2,6],49:[2,6],53:[2,6]},{5:[2,7],13:[2,7],14:[2,7],17:[2,7],27:[2,7],32:[2,7],37:[2,7],42:[2,7],45:[2,7],46:[2,7],49:[2,7],53:[2,7]},{5:[2,8],13:[2,8],14:[2,8],17:[2,8],27:[2,8],32:[2,8],37:[2,8],42:[2,8],45:[2,8],46:[2,8],49:[2,8],53:[2,8]},{18:22,66:[1,32],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{18:33,66:[1,32],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{4:34,6:3,13:[2,43],14:[2,43],17:[2,43],27:[2,43],32:[2,43],37:[2,43],42:[2,43],45:[2,43],46:[2,43],49:[2,43],53:[2,43]},{4:35,6:3,13:[2,43],14:[2,43],17:[2,43],27:[2,43],32:[2,43],42:[2,43],45:[2,43],46:[2,43],49:[2,43],53:[2,43]},{12:36,14:[1,18]},{18:38,54:37,58:39,59:[1,40],66:[1,32],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{5:[2,9],13:[2,9],14:[2,9],16:[2,9],17:[2,9],27:[2,9],32:[2,9],37:[2,9],42:[2,9],45:[2,9],46:[2,9],49:[2,9],53:[2,9]},{18:41,66:[1,32],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{18:42,66:[1,32],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{18:43,66:[1,32],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{31:[2,73],47:44,59:[2,73],66:[2,73],74:[2,73],75:[2,73],76:[2,73],77:[2,73],78:[2,73],79:[2,73]},{21:[2,30],31:[2,30],52:[2,30],59:[2,30],62:[2,30],66:[2,30],69:[2,30],74:[2,30],75:[2,30],76:[2,30],77:[2,30],78:[2,30],79:[2,30]},{21:[2,31],31:[2,31],52:[2,31],59:[2,31],62:[2,31],66:[2,31],69:[2,31],74:[2,31],75:[2,31],76:[2,31],77:[2,31],78:[2,31],79:[2,31]},{21:[2,32],31:[2,32],52:[2,32],59:[2,32],62:[2,32],66:[2,32],69:[2,32],74:[2,32],75:[2,32],76:[2,32],77:[2,32],78:[2,32],79:[2,32]},{21:[2,33],31:[2,33],52:[2,33],59:[2,33],62:[2,33],66:[2,33],69:[2,33],74:[2,33],75:[2,33],76:[2,33],77:[2,33],78:[2,33],79:[2,33]},{21:[2,34],31:[2,34],52:[2,34],59:[2,34],62:[2,34],66:[2,34],69:[2,34],74:[2,34],75:[2,34],76:[2,34],77:[2,34],78:[2,34],79:[2,34]},{21:[2,35],31:[2,35],52:[2,35],59:[2,35],62:[2,35],66:[2,35],69:[2,35],74:[2,35],75:[2,35],76:[2,35],77:[2,35],78:[2,35],79:[2,35]},{21:[2,36],31:[2,36],52:[2,36],59:[2,36],62:[2,36],66:[2,36],69:[2,36],74:[2,36],75:[2,36],76:[2,36],77:[2,36],78:[2,36],79:[2,36]},{21:[2,40],31:[2,40],52:[2,40],59:[2,40],62:[2,40],66:[2,40],69:[2,40],74:[2,40],75:[2,40],76:[2,40],77:[2,40],78:[2,40],79:[2,40],81:[1,45]},{66:[1,32],80:46},{21:[2,42],31:[2,42],52:[2,42],59:[2,42],62:[2,42],66:[2,42],69:[2,42],74:[2,42],75:[2,42],76:[2,42],77:[2,42],78:[2,42],79:[2,42],81:[2,42]},{50:47,52:[2,77],59:[2,77],66:[2,77],74:[2,77],75:[2,77],76:[2,77],77:[2,77],78:[2,77],79:[2,77]},{23:48,36:50,37:[1,52],41:51,42:[1,53],43:49,45:[2,49]},{26:54,41:55,42:[1,53],45:[2,51]},{16:[1,56]},{31:[2,81],55:57,59:[2,81],66:[2,81],74:[2,81],75:[2,81],76:[2,81],77:[2,81],78:[2,81],79:[2,81]},{31:[2,37],59:[2,37],66:[2,37],74:[2,37],75:[2,37],76:[2,37],77:[2,37],78:[2,37],79:[2,37]},{31:[2,38],59:[2,38],66:[2,38],74:[2,38],75:[2,38],76:[2,38],77:[2,38],78:[2,38],79:[2,38]},{18:58,66:[1,32],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{28:59,31:[2,53],59:[2,53],66:[2,53],69:[2,53],74:[2,53],75:[2,53],76:[2,53],77:[2,53],78:[2,53],79:[2,53]},{31:[2,59],33:60,59:[2,59],66:[2,59],69:[2,59],74:[2,59],75:[2,59],76:[2,59],77:[2,59],78:[2,59],79:[2,59]},{19:61,21:[2,45],59:[2,45],66:[2,45],74:[2,45],75:[2,45],76:[2,45],77:[2,45],78:[2,45],79:[2,45]},{18:65,31:[2,75],48:62,57:63,58:66,59:[1,40],63:64,64:67,65:68,66:[1,69],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{66:[1,70]},{21:[2,39],31:[2,39],52:[2,39],59:[2,39],62:[2,39],66:[2,39],69:[2,39],74:[2,39],75:[2,39],76:[2,39],77:[2,39],78:[2,39],79:[2,39],81:[1,45]},{18:65,51:71,52:[2,79],57:72,58:66,59:[1,40],63:73,64:67,65:68,66:[1,69],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{24:74,45:[1,75]},{45:[2,50]},{4:76,6:3,13:[2,43],14:[2,43],17:[2,43],27:[2,43],32:[2,43],37:[2,43],42:[2,43],45:[2,43],46:[2,43],49:[2,43],53:[2,43]},{45:[2,19]},{18:77,66:[1,32],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{4:78,6:3,13:[2,43],14:[2,43],17:[2,43],27:[2,43],32:[2,43],45:[2,43],46:[2,43],49:[2,43],53:[2,43]},{24:79,45:[1,75]},{45:[2,52]},{5:[2,10],13:[2,10],14:[2,10],17:[2,10],27:[2,10],32:[2,10],37:[2,10],42:[2,10],45:[2,10],46:[2,10],49:[2,10],53:[2,10]},{18:65,31:[2,83],56:80,57:81,58:66,59:[1,40],63:82,64:67,65:68,66:[1,69],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{59:[2,85],60:83,62:[2,85],66:[2,85],74:[2,85],75:[2,85],76:[2,85],77:[2,85],78:[2,85],79:[2,85]},{18:65,29:84,31:[2,55],57:85,58:66,59:[1,40],63:86,64:67,65:68,66:[1,69],69:[2,55],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{18:65,31:[2,61],34:87,57:88,58:66,59:[1,40],63:89,64:67,65:68,66:[1,69],69:[2,61],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{18:65,20:90,21:[2,47],57:91,58:66,59:[1,40],63:92,64:67,65:68,66:[1,69],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{31:[1,93]},{31:[2,74],59:[2,74],66:[2,74],74:[2,74],75:[2,74],76:[2,74],77:[2,74],78:[2,74],79:[2,74]},{31:[2,76]},{21:[2,24],31:[2,24],52:[2,24],59:[2,24],62:[2,24],66:[2,24],69:[2,24],74:[2,24],75:[2,24],76:[2,24],77:[2,24],78:[2,24],79:[2,24]},{21:[2,25],31:[2,25],52:[2,25],59:[2,25],62:[2,25],66:[2,25],69:[2,25],74:[2,25],75:[2,25],76:[2,25],77:[2,25],78:[2,25],79:[2,25]},{21:[2,27],31:[2,27],52:[2,27],62:[2,27],65:94,66:[1,95],69:[2,27]},{21:[2,89],31:[2,89],52:[2,89],62:[2,89],66:[2,89],69:[2,89]},{21:[2,42],31:[2,42],52:[2,42],59:[2,42],62:[2,42],66:[2,42],67:[1,96],69:[2,42],74:[2,42],75:[2,42],76:[2,42],77:[2,42],78:[2,42],79:[2,42],81:[2,42]},{21:[2,41],31:[2,41],52:[2,41],59:[2,41],62:[2,41],66:[2,41],69:[2,41],74:[2,41],75:[2,41],76:[2,41],77:[2,41],78:[2,41],79:[2,41],81:[2,41]},{52:[1,97]},{52:[2,78],59:[2,78],66:[2,78],74:[2,78],75:[2,78],76:[2,78],77:[2,78],78:[2,78],79:[2,78]},{52:[2,80]},{5:[2,12],13:[2,12],14:[2,12],17:[2,12],27:[2,12],32:[2,12],37:[2,12],42:[2,12],45:[2,12],46:[2,12],49:[2,12],53:[2,12]},{18:98,66:[1,32],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{36:50,37:[1,52],41:51,42:[1,53],43:100,44:99,45:[2,71]},{31:[2,65],38:101,59:[2,65],66:[2,65],69:[2,65],74:[2,65],75:[2,65],76:[2,65],77:[2,65],78:[2,65],79:[2,65]},{45:[2,17]},{5:[2,13],13:[2,13],14:[2,13],17:[2,13],27:[2,13],32:[2,13],37:[2,13],42:[2,13],45:[2,13],46:[2,13],49:[2,13],53:[2,13]},{31:[1,102]},{31:[2,82],59:[2,82],66:[2,82],74:[2,82],75:[2,82],76:[2,82],77:[2,82],78:[2,82],79:[2,82]},{31:[2,84]},{18:65,57:104,58:66,59:[1,40],61:103,62:[2,87],63:105,64:67,65:68,66:[1,69],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{30:106,31:[2,57],68:107,69:[1,108]},{31:[2,54],59:[2,54],66:[2,54],69:[2,54],74:[2,54],75:[2,54],76:[2,54],77:[2,54],78:[2,54],79:[2,54]},{31:[2,56],69:[2,56]},{31:[2,63],35:109,68:110,69:[1,108]},{31:[2,60],59:[2,60],66:[2,60],69:[2,60],74:[2,60],75:[2,60],76:[2,60],77:[2,60],78:[2,60],79:[2,60]},{31:[2,62],69:[2,62]},{21:[1,111]},{21:[2,46],59:[2,46],66:[2,46],74:[2,46],75:[2,46],76:[2,46],77:[2,46],78:[2,46],79:[2,46]},{21:[2,48]},{5:[2,21],13:[2,21],14:[2,21],17:[2,21],27:[2,21],32:[2,21],37:[2,21],42:[2,21],45:[2,21],46:[2,21],49:[2,21],53:[2,21]},{21:[2,90],31:[2,90],52:[2,90],62:[2,90],66:[2,90],69:[2,90]},{67:[1,96]},{18:65,57:112,58:66,59:[1,40],66:[1,32],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{5:[2,22],13:[2,22],14:[2,22],17:[2,22],27:[2,22],32:[2,22],37:[2,22],42:[2,22],45:[2,22],46:[2,22],49:[2,22],53:[2,22]},{31:[1,113]},{45:[2,18]},{45:[2,72]},{18:65,31:[2,67],39:114,57:115,58:66,59:[1,40],63:116,64:67,65:68,66:[1,69],69:[2,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{5:[2,23],13:[2,23],14:[2,23],17:[2,23],27:[2,23],32:[2,23],37:[2,23],42:[2,23],45:[2,23],46:[2,23],49:[2,23],53:[2,23]},{62:[1,117]},{59:[2,86],62:[2,86],66:[2,86],74:[2,86],75:[2,86],76:[2,86],77:[2,86],78:[2,86],79:[2,86]},{62:[2,88]},{31:[1,118]},{31:[2,58]},{66:[1,120],70:119},{31:[1,121]},{31:[2,64]},{14:[2,11]},{21:[2,28],31:[2,28],52:[2,28],62:[2,28],66:[2,28],69:[2,28]},{5:[2,20],13:[2,20],14:[2,20],17:[2,20],27:[2,20],32:[2,20],37:[2,20],42:[2,20],45:[2,20],46:[2,20],49:[2,20],53:[2,20]},{31:[2,69],40:122,68:123,69:[1,108]},{31:[2,66],59:[2,66],66:[2,66],69:[2,66],74:[2,66],75:[2,66],76:[2,66],77:[2,66],78:[2,66],79:[2,66]},{31:[2,68],69:[2,68]},{21:[2,26],31:[2,26],52:[2,26],59:[2,26],62:[2,26],66:[2,26],69:[2,26],74:[2,26],75:[2,26],76:[2,26],77:[2,26],78:[2,26],79:[2,26]},{13:[2,14],14:[2,14],17:[2,14],27:[2,14],32:[2,14],37:[2,14],42:[2,14],45:[2,14],46:[2,14],49:[2,14],53:[2,14]},{66:[1,125],71:[1,124]},{66:[2,91],71:[2,91]},{13:[2,15],14:[2,15],17:[2,15],27:[2,15],32:[2,15],42:[2,15],45:[2,15],46:[2,15],49:[2,15],53:[2,15]},{31:[1,126]},{31:[2,70]},{31:[2,29]},{66:[2,92],71:[2,92]},{13:[2,16],14:[2,16],17:[2,16],27:[2,16],32:[2,16],37:[2,16],42:[2,16],45:[2,16],46:[2,16],49:[2,16],53:[2,16]}],
defaultActions: {4:[2,1],49:[2,50],51:[2,19],55:[2,52],64:[2,76],73:[2,80],78:[2,17],82:[2,84],92:[2,48],99:[2,18],100:[2,72],105:[2,88],107:[2,58],110:[2,64],111:[2,11],123:[2,70],124:[2,29]},
parseError: function parseError(str, hash) {

@@ -521,3 +525,3 @@ throw new Error(str);

break;
case 25:return 79;
case 25:return 81;
break;

@@ -534,3 +538,3 @@ case 26:// ignore whitespace

break;
case 31:return 77;
case 31:return 79;
break;

@@ -541,20 +545,24 @@ case 32:return 76;

break;
case 34:return 75;
case 34:return 77;
break;
case 35:return 69;
case 35:return 78;
break;
case 36:return 71;
case 36:return 75;
break;
case 37:return 66;
case 37:return 69;
break;
case 38:yy_.yytext = strip(1,2); return 66;
case 38:return 71;
break;
case 39:return 'INVALID';
case 39:return 66;
break;
case 40:return 5;
case 40:return 66;
break;
case 41:return 'INVALID';
break;
case 42:return 5;
break;
}
};
lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/];
lexer.conditions = {"mu":{"rules":[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,33,34,35,36,37,38,39,40],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[5],"inclusive":false},"raw":{"rules":[3,4],"inclusive":false},"INITIAL":{"rules":[0,1,40],"inclusive":true}};
lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/];
lexer.conditions = {"mu":{"rules":[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,33,34,35,36,37,38,39,40,41,42],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[5],"inclusive":false},"raw":{"rules":[3,4],"inclusive":false},"INITIAL":{"rules":[0,1,42],"inclusive":true}};
return lexer;})()

@@ -561,0 +569,0 @@ parser.lexer = lexer;

@@ -1,2 +0,3 @@

import Visitor from "./visitor";
/*eslint-disable new-cap */
import Visitor from './visitor';

@@ -14,9 +15,9 @@ export function print(ast) {

PrintVisitor.prototype.pad = function(string) {
var out = "";
let out = '';
for(var i=0,l=this.padding; i<l; i++) {
out = out + " ";
for (let i = 0, l = this.padding; i < l; i++) {
out = out + ' ';
}
out = out + string + "\n";
out = out + string + '\n';
return out;

@@ -26,3 +27,3 @@ };

PrintVisitor.prototype.Program = function(program) {
var out = '',
let out = '',
body = program.body,

@@ -32,4 +33,4 @@ i, l;

if (program.blockParams) {
var blockParams = 'BLOCK PARAMS: [';
for(i=0, l=program.blockParams.length; i<l; i++) {
let blockParams = 'BLOCK PARAMS: [';
for (i = 0, l = program.blockParams.length; i < l; i++) {
blockParams += ' ' + program.blockParams[i];

@@ -41,3 +42,3 @@ }

for(i=0, l=body.length; i<l; i++) {
for (i = 0, l = body.length; i < l; i++) {
out = out + this.accept(body[i]);

@@ -56,3 +57,3 @@ }

PrintVisitor.prototype.BlockStatement = function(block) {
var out = "";
let out = '';

@@ -82,4 +83,4 @@ out = out + this.pad('BLOCK:');

PrintVisitor.prototype.PartialStatement = function(partial) {
var content = 'PARTIAL:' + partial.name.original;
if(partial.params[0]) {
let content = 'PARTIAL:' + partial.name.original;
if (partial.params[0]) {
content += ' ' + this.accept(partial.params[0]);

@@ -102,17 +103,19 @@ }

PrintVisitor.prototype.SubExpression = function(sexpr) {
var params = sexpr.params, paramStrings = [], hash;
let params = sexpr.params,
paramStrings = [],
hash;
for(var i=0, l=params.length; i<l; i++) {
for (let i = 0, l = params.length; i < l; i++) {
paramStrings.push(this.accept(params[i]));
}
params = "[" + paramStrings.join(", ") + "]";
params = '[' + paramStrings.join(', ') + ']';
hash = sexpr.hash ? " " + this.accept(sexpr.hash) : "";
hash = sexpr.hash ? ' ' + this.accept(sexpr.hash) : '';
return this.accept(sexpr.path) + " " + params + hash;
return this.accept(sexpr.path) + ' ' + params + hash;
};
PrintVisitor.prototype.PathExpression = function(id) {
var path = id.parts.join('/');
let path = id.parts.join('/');
return (id.data ? '@' : '') + 'PATH:' + path;

@@ -127,14 +130,22 @@ };

PrintVisitor.prototype.NumberLiteral = function(number) {
return "NUMBER{" + number.value + "}";
return 'NUMBER{' + number.value + '}';
};
PrintVisitor.prototype.BooleanLiteral = function(bool) {
return "BOOLEAN{" + bool.value + "}";
return 'BOOLEAN{' + bool.value + '}';
};
PrintVisitor.prototype.UndefinedLiteral = function() {
return 'UNDEFINED';
};
PrintVisitor.prototype.NullLiteral = function() {
return 'NULL';
};
PrintVisitor.prototype.Hash = function(hash) {
var pairs = hash.pairs;
var joinedPairs = [];
let pairs = hash.pairs,
joinedPairs = [];
for (var i=0, l=pairs.length; i<l; i++) {
for (let i = 0, l = pairs.length; i < l; i++) {
joinedPairs.push(this.accept(pairs[i]));

@@ -148,1 +159,2 @@ }

};
/*eslint-enable new-cap */

@@ -1,3 +0,3 @@

import Exception from "../exception";
import AST from "./ast";
import Exception from '../exception';
import AST from './ast';

@@ -14,3 +14,3 @@ function Visitor() {

acceptKey: function(node, name) {
var value = this.accept(node[name]);
let value = this.accept(node[name]);
if (this.mutating) {

@@ -38,3 +38,3 @@ // Hacky sanity check:

acceptArray: function(array) {
for (var i = 0, l = array.length; i < l; i++) {
for (let i = 0, l = array.length; i < l; i++) {
this.acceptKey(array, i);

@@ -60,3 +60,3 @@

var ret = this[object.type](object);
let ret = this[object.type](object);

@@ -105,7 +105,2 @@ this.current = this.parents.shift();

},
PartialExpression: function(partial) {
this.acceptRequired(partial, 'name');
this.acceptArray(partial.params);
this.acceptKey(partial, 'hash');
},

@@ -117,2 +112,4 @@ PathExpression: function(/* path */) {},

BooleanLiteral: function(/* bool */) {},
UndefinedLiteral: function(/* literal */) {},
NullLiteral: function(/* literal */) {},

@@ -119,0 +116,0 @@ Hash: function(hash) {

@@ -1,2 +0,2 @@

import Visitor from "./visitor";
import Visitor from './visitor';

@@ -8,8 +8,8 @@ function WhitespaceControl() {

WhitespaceControl.prototype.Program = function(program) {
var isRoot = !this.isRootSeen;
let isRoot = !this.isRootSeen;
this.isRootSeen = true;
var body = program.body;
for (var i = 0, l = body.length; i < l; i++) {
var current = body[i],
let body = program.body;
for (let i = 0, l = body.length; i < l; i++) {
let current = body[i],
strip = this.accept(current);

@@ -21,3 +21,3 @@

var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot),
let _isPrevWhitespace = isPrevWhitespace(body, i, isRoot),
_isNextWhitespace = isNextWhitespace(body, i, isRoot),

@@ -43,3 +43,3 @@

// Pull out the whitespace from the final line
current.indent = (/([ \t]+$)/).exec(body[i-1].original)[1];
current.indent = (/([ \t]+$)/).exec(body[i - 1].original)[1];
}

@@ -69,3 +69,3 @@ }

// Find the inverse program that is involed with whitespace stripping.
var program = block.program || block.inverse,
let program = block.program || block.inverse,
inverse = block.program && block.inverse,

@@ -80,7 +80,7 @@ firstInverse = inverse,

while (lastInverse.chained) {
lastInverse = lastInverse.body[lastInverse.body.length-1].program;
lastInverse = lastInverse.body[lastInverse.body.length - 1].program;
}
}
var strip = {
let strip = {
open: block.openStrip.open,

@@ -100,3 +100,3 @@ close: block.closeStrip.close,

if (inverse) {
var inverseStrip = block.inverseStrip;
let inverseStrip = block.inverseStrip;

@@ -117,10 +117,7 @@ if (inverseStrip.open) {

&& isNextWhitespace(firstInverse.body)) {
omitLeft(program.body);
omitRight(firstInverse.body);
}
} else {
if (block.closeStrip.open) {
omitLeft(program.body, null, true);
}
} else if (block.closeStrip.open) {
omitLeft(program.body, null, true);
}

@@ -135,6 +132,6 @@

WhitespaceControl.prototype.PartialStatement =
WhitespaceControl.prototype.PartialStatement =
WhitespaceControl.prototype.CommentStatement = function(node) {
/* istanbul ignore next */
var strip = node.strip || {};
let strip = node.strip || {};
return {

@@ -155,4 +152,4 @@ inlineStandalone: true,

// cased for strip operations)
var prev = body[i-1],
sibling = body[i-2];
let prev = body[i - 1],
sibling = body[i - 2];
if (!prev) {

@@ -171,4 +168,4 @@ return isRoot;

var next = body[i+1],
sibling = body[i+2];
let next = body[i + 1],
sibling = body[i + 2];
if (!next) {

@@ -191,3 +188,3 @@ return isRoot;

function omitRight(body, i, multiple) {
var current = body[i == null ? 0 : i + 1];
let current = body[i == null ? 0 : i + 1];
if (!current || current.type !== 'ContentStatement' || (!multiple && current.rightStripped)) {

@@ -197,3 +194,3 @@ return;

var original = current.value;
let original = current.value;
current.value = current.value.replace(multiple ? (/^\s+/) : (/^[ \t]*\r?\n?/), '');

@@ -211,3 +208,3 @@ current.rightStripped = current.value !== original;

function omitLeft(body, i, multiple) {
var current = body[i == null ? body.length - 1 : i - 1];
let current = body[i == null ? body.length - 1 : i - 1];
if (!current || current.type !== 'ContentStatement' || (!multiple && current.leftStripped)) {

@@ -218,3 +215,3 @@ return;

// We omit the last node if it's whitespace only and not preceeded by a non-content node.
var original = current.value;
let original = current.value;
current.value = current.value.replace(multiple ? (/\s+$/) : (/[ \t]+$/), '');

@@ -221,0 +218,0 @@ current.leftStripped = current.value !== original;

var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
const errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
function Exception(message, node) {
var loc = node && node.loc,
let loc = node && node.loc,
line,

@@ -15,9 +15,13 @@ column;

var tmp = Error.prototype.constructor.call(this, message);
let 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++) {
for (let idx = 0; idx < errorProps.length; idx++) {
this[errorProps[idx]] = tmp[errorProps[idx]];
}
if (Error.captureStackTrace) {
Error.captureStackTrace(this, Exception);
}
if (loc) {

@@ -24,0 +28,0 @@ this.lineNumber = line;

@@ -1,19 +0,19 @@

module Utils from "./utils";
import Exception from "./exception";
import { COMPILER_REVISION, REVISION_CHANGES, createFrame } from "./base";
import * as Utils from './utils';
import Exception from './exception';
import { COMPILER_REVISION, REVISION_CHANGES, createFrame } from './base';
export function checkRevision(compilerInfo) {
var compilerRevision = compilerInfo && compilerInfo[0] || 1,
currentRevision = COMPILER_REVISION;
const 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+").");
const 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]+").");
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] + ').');
}

@@ -28,3 +28,3 @@ }

if (!env) {
throw new Exception("No environment passed to template");
throw new Exception('No environment passed to template');
}

@@ -39,3 +39,3 @@ if (!templateSpec || !templateSpec.main) {

var invokePartialWrapper = function(partial, context, options) {
function invokePartialWrapper(partial, context, options) {
if (options.hash) {

@@ -46,3 +46,3 @@ context = Utils.extend({}, context, options.hash);

partial = env.VM.resolvePartial.call(this, partial, context, options);
var result = env.VM.invokePartial.call(this, partial, context, options);
let result = env.VM.invokePartial.call(this, partial, context, options);

@@ -55,4 +55,4 @@ if (result == null && env.compile) {

if (options.indent) {
var lines = result.split('\n');
for (var i = 0, l = lines.length; i < l; i++) {
let lines = result.split('\n');
for (let i = 0, l = lines.length; i < l; i++) {
if (!lines[i] && i + 1 === l) {

@@ -68,8 +68,8 @@ break;

} else {
throw new Exception("The partial " + options.name + " could not be compiled when running in runtime-only mode");
throw new Exception('The partial ' + options.name + ' could not be compiled when running in runtime-only mode');
}
};
}
// Just add water
var container = {
let container = {
strict: function(obj, name) {

@@ -82,4 +82,4 @@ if (!(name in obj)) {

lookup: function(depths, name) {
var len = depths.length;
for (var i = 0; i < len; i++) {
const len = depths.length;
for (let i = 0; i < len; i++) {
if (depths[i] && depths[i][name] != null) {

@@ -103,8 +103,8 @@ return depths[i][name];

program: function(i, data, declaredBlockParams, blockParams, depths) {
var programWrapper = this.programs[i],
let programWrapper = this.programs[i],
fn = this.fn(i);
if (data || depths || blockParams || declaredBlockParams) {
programWrapper = program(this, i, fn, data, declaredBlockParams, blockParams, depths);
programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths);
} else if (!programWrapper) {
programWrapper = this.programs[i] = program(this, i, fn);
programWrapper = this.programs[i] = wrapProgram(this, i, fn);
}

@@ -114,16 +114,16 @@ return programWrapper;

data: function(data, depth) {
while (data && depth--) {
data = data._parent;
data: function(value, depth) {
while (value && depth--) {
value = value._parent;
}
return data;
return value;
},
merge: function(param, common) {
var ret = param || common;
let obj = param || common;
if (param && common && (param !== common)) {
ret = Utils.extend({}, common, param);
obj = Utils.extend({}, common, param);
}
return ret;
return obj;
},

@@ -135,5 +135,4 @@

var ret = function(context, options) {
options = options || {};
var data = options.data;
function ret(context, options = {}) {
let data = options.data;

@@ -144,3 +143,3 @@ ret._setup(options);

}
var depths,
let depths,
blockParams = templateSpec.useBlockParams ? [] : undefined;

@@ -152,3 +151,3 @@ if (templateSpec.useDepths) {

return templateSpec.main.call(container, context, container.helpers, container.partials, data, blockParams, depths);
};
}
ret.isTop = true;

@@ -177,3 +176,3 @@

return program(container, i, templateSpec[i], data, 0, blockParams, depths);
return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths);
};

@@ -183,6 +182,4 @@ return ret;

export function program(container, i, fn, data, declaredBlockParams, blockParams, depths) {
var prog = function(context, options) {
options = options || {};
export function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) {
function prog(context, options = {}) {
return fn.call(container,

@@ -194,3 +191,3 @@ context,

depths && [context].concat(depths));
};
}
prog.program = i;

@@ -216,5 +213,5 @@ prog.depth = depths ? depths.length : 0;

if(partial === undefined) {
throw new Exception("The partial " + options.name + " could not be found");
} else if(partial instanceof Function) {
if (partial === undefined) {
throw new Exception('The partial ' + options.name + ' could not be found');
} else if (partial instanceof Function) {
return partial(context, options);

@@ -224,3 +221,3 @@ }

export function noop() { return ""; }
export function noop() { return ''; }

@@ -227,0 +224,0 @@ function initData(context, data) {

@@ -7,5 +7,5 @@ // Build out our basic SafeString type

SafeString.prototype.toString = SafeString.prototype.toHTML = function() {
return "" + this.string;
return '' + this.string;
};
export default SafeString;
/*jshint -W004 */
var escape = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#x27;",
"`": "&#x60;"
const escape = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#x27;',
'`': '&#x60;'
};
var badChars = /[&<>"'`]/g;
var possible = /[&<>"'`]/;
const badChars = /[&<>"'`]/g,
possible = /[&<>"'`]/;

@@ -19,4 +19,4 @@ function escapeChar(chr) {

export function extend(obj /* , ...source */) {
for (var i = 1; i < arguments.length; i++) {
for (var key in arguments[i]) {
for (let i = 1; i < arguments.length; i++) {
for (let key in arguments[i]) {
if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {

@@ -31,6 +31,7 @@ obj[key] = arguments[i][key];

export var toString = Object.prototype.toString;
export let toString = Object.prototype.toString;
// Sourced from lodash
// https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
/*eslint-disable func-style, no-var */
var isFunction = function(value) {

@@ -47,5 +48,6 @@ return typeof value === 'function';

export var isFunction;
/*eslint-enable func-style, no-var */
/* istanbul ignore next */
export var isArray = Array.isArray || function(value) {
export const isArray = Array.isArray || function(value) {
return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false;

@@ -56,3 +58,3 @@ };

export function indexOf(array, value) {
for (var i = 0, len = array.length; i < len; i++) {
for (let i = 0, len = array.length; i < len; i++) {
if (array[i] === value) {

@@ -59,0 +61,0 @@ return i;

// USAGE:
// var handlebars = require('handlebars');
/* eslint-disable no-var */
// var local = handlebars.create();
var handlebars = require('../dist/cjs/handlebars')["default"];
var handlebars = require('../dist/cjs/handlebars')['default'];
handlebars.Visitor = require('../dist/cjs/handlebars/compiler/visitor')["default"];
var printer = require('../dist/cjs/handlebars/compiler/printer');

@@ -17,11 +16,11 @@ handlebars.PrintVisitor = printer.PrintVisitor;

// Publish a Node.js require() handler for .handlebars and .hbs files
function extension(module, filename) {
var fs = require('fs');
var templateString = fs.readFileSync(filename, 'utf8');
module.exports = handlebars.compile(templateString);
}
/* istanbul ignore else */
if (typeof require !== 'undefined' && require.extensions) {
var extension = function(module, filename) {
var fs = require("fs");
var templateString = fs.readFileSync(filename, "utf8");
module.exports = handlebars.compile(templateString);
};
require.extensions[".handlebars"] = extension;
require.extensions[".hbs"] = extension;
require.extensions['.handlebars'] = extension;
require.extensions['.hbs'] = extension;
}

@@ -0,10 +1,8 @@

/*eslint-disable no-console */
import fs from 'fs';
import * as Handlebars from './handlebars';
import {basename} from 'path';
import {SourceMapConsumer, SourceNode} from 'source-map';
import uglify from 'uglify-js';
var fs = require('fs'),
Handlebars = require('./index'),
basename = require('path').basename,
SourceMap = require('source-map'),
SourceMapConsumer = SourceMap.SourceMapConsumer,
SourceNode = SourceMap.SourceNode,
uglify = require('uglify-js');
module.exports.cli = function(opts) {

@@ -24,3 +22,3 @@ if (opts.version) {

} catch (err) {
throw new Handlebars.Exception('Unable to open template file "' + template + '"');
throw new Handlebars.Exception(`Unable to open template file "${template}"`);
}

@@ -37,3 +35,3 @@ });

// Convert the known list into a hash
var known = {};
let known = {};
if (opts.known && !Array.isArray(opts.known)) {

@@ -43,3 +41,3 @@ opts.known = [opts.known];

if (opts.known) {
for (var i = 0, len = opts.known.length; i < len; i++) {
for (let i = 0, len = opts.known.length; i < len; i++) {
known[opts.known[i]] = true;

@@ -50,6 +48,6 @@ }

// Build file extension pattern
var extension = opts.extension.replace(/[\\^$*+?.():=!|{}\-\[\]]/g, function(arg) { return '\\' + arg; });
let extension = opts.extension.replace(/[\\^$*+?.():=!|{}\-\[\]]/g, function(arg) { return '\\' + arg; });
extension = new RegExp('\\.' + extension + '$');
var output = new SourceNode();
let output = new SourceNode();
if (!opts.simple) {

@@ -73,14 +71,14 @@ if (opts.amd) {

function processTemplate(template, root) {
var path = template,
let path = template,
stat = fs.statSync(path);
if (stat.isDirectory()) {
fs.readdirSync(template).map(function(file) {
var path = template + '/' + file;
let childPath = template + '/' + file;
if (extension.test(path) || fs.statSync(path).isDirectory()) {
processTemplate(path, root || template);
if (extension.test(childPath) || fs.statSync(childPath).isDirectory()) {
processTemplate(childPath, root || template);
}
});
} else {
var data = fs.readFileSync(path, 'utf8');
let data = fs.readFileSync(path, 'utf8');

@@ -91,3 +89,3 @@ if (opts.bom && data.indexOf('\uFEFF') === 0) {

var options = {
let options = {
knownHelpers: known,

@@ -108,11 +106,11 @@ knownHelpersOnly: opts.o

} else if (template.indexOf(root) === 0) {
template = template.substring(root.length+1);
template = template.substring(root.length + 1);
}
template = template.replace(extension, '');
var precompiled = Handlebars.precompile(data, options);
let precompiled = Handlebars.precompile(data, options);
// If we are generating a source map, we have to reconstruct the SourceNode object
if (opts.map) {
var consumer = new SourceMapConsumer(precompiled.map);
let consumer = new SourceMapConsumer(precompiled.map);
precompiled = SourceNode.fromStringWithSourceMap(precompiled.code, consumer);

@@ -124,3 +122,3 @@ }

} else if (opts.partial) {
if(opts.amd && (opts.templates.length == 1 && !fs.statSync(opts.templates[0]).isDirectory())) {
if (opts.amd && (opts.templates.length == 1 && !fs.statSync(opts.templates[0]).isDirectory())) {
output.add('return ');

@@ -130,3 +128,3 @@ }

} else {
if(opts.amd && (opts.templates.length == 1 && !fs.statSync(opts.templates[0]).isDirectory())) {
if (opts.amd && (opts.templates.length == 1 && !fs.statSync(opts.templates[0]).isDirectory())) {
output.add('return ');

@@ -146,4 +144,4 @@ }

if (opts.amd) {
if(opts.templates.length > 1 || (opts.templates.length == 1 && fs.statSync(opts.templates[0]).isDirectory())) {
if(opts.partial){
if (opts.templates.length > 1 || (opts.templates.length == 1 && fs.statSync(opts.templates[0]).isDirectory())) {
if (opts.partial) {
output.add('return Handlebars.partials;\n');

@@ -150,0 +148,0 @@ } else {

{
"name": "handlebars",
"barename": "handlebars",
"version": "3.0.1",
"version": "3.0.2",
"description": "Handlebars provides the power necessary to let you build semantic templates effectively with no frustration",

@@ -33,7 +33,9 @@ "homepage": "http://www.handlebarsjs.com/",

"aws-sdk": "~1.5.0",
"babel-loader": "^5.0.0",
"babel-runtime": "^5.1.10",
"benchmark": "~1.0",
"dustjs-linkedin": "^2.0.2",
"eco": "~1.1.0-rc-3",
"es6-module-packager": "^2.0.0",
"grunt": "~0.4.1",
"grunt-babel": "^5.0.0",
"grunt-cli": "~0.1.10",

@@ -48,3 +50,5 @@ "grunt-contrib-clean": "0.x",

"grunt-contrib-watch": "0.x",
"grunt-eslint": "^11.0.0",
"grunt-saucelabs": "8.x",
"grunt-webpack": "^1.0.8",
"istanbul": "^0.3.0",

@@ -51,0 +55,0 @@ "jison": "~0.3.0",

@@ -5,4 +5,15 @@ # Release Notes

[Commits](https://github.com/wycats/handlebars.js/compare/v3.0.1...master)
[Commits](https://github.com/wycats/handlebars.js/compare/v3.0.2...master)
## v3.0.2 - April 20th, 2015
- [#998](https://github.com/wycats/handlebars.js/pull/998) - Add full support for es6 ([@kpdecker](https://api.github.com/users/kpdecker))
- [#994](https://github.com/wycats/handlebars.js/issues/994) - Access Handlebars.Visitor in browser ([@tamlyn](https://api.github.com/users/tamlyn))
- [#990](https://github.com/wycats/handlebars.js/issues/990) - Allow passing null/undefined literals subexpressions ([@blimmer](https://api.github.com/users/blimmer))
- [#989](https://github.com/wycats/handlebars.js/issues/989) - Source-map error with requirejs ([@SteppeEagle](https://api.github.com/users/SteppeEagle))
- [#967](https://github.com/wycats/handlebars.js/issues/967) - can't access "this" property ([@75lb](https://api.github.com/users/75lb))
- Use captureStackTrace for error handler - a009a97
- Ignore branches tested without coverage monitoring - 37a664b
[Commits](https://github.com/wycats/handlebars.js/compare/v3.0.1...v3.0.2)
## v3.0.1 - March 24th, 2015

@@ -9,0 +20,0 @@ - [#984](https://github.com/wycats/handlebars.js/pull/984) - Adding documentation for passing arguments into partials ([@johneke](https://api.github.com/users/johneke))

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc