5
Copyright (C) 2011-2015 by Yehuda Katz
7
Permission is hereby granted, free of charge, to any person obtaining a copy
8
of this software and associated documentation files (the "Software"), to deal
9
in the Software without restriction, including without limitation the rights
10
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
copies of the Software, and to permit persons to whom the Software is
12
furnished to do so, subject to the following conditions:
14
The above copyright notice and this permission notice shall be included in
15
all copies or substantial portions of the Software.
17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27
(function webpackUniversalModuleDefinition(root, factory) {
28
if(typeof exports === 'object' && typeof module === 'object')
29
module.exports = factory();
30
else if(typeof define === 'function' && define.amd)
32
else if(typeof exports === 'object')
33
exports["Handlebars"] = factory();
35
root["Handlebars"] = factory();
37
return /******/ (function(modules) { // webpackBootstrap
38
/******/ // The module cache
39
/******/ var installedModules = {};
41
/******/ // The require function
42
/******/ function __webpack_require__(moduleId) {
44
/******/ // Check if module is in cache
45
/******/ if(installedModules[moduleId])
46
/******/ return installedModules[moduleId].exports;
48
/******/ // Create a new module (and put it into the cache)
49
/******/ var module = installedModules[moduleId] = {
51
/******/ id: moduleId,
52
/******/ loaded: false
55
/******/ // Execute the module function
56
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
58
/******/ // Flag the module as loaded
59
/******/ module.loaded = true;
61
/******/ // Return the exports of the module
62
/******/ return module.exports;
66
/******/ // expose the modules object (__webpack_modules__)
67
/******/ __webpack_require__.m = modules;
69
/******/ // expose the module cache
70
/******/ __webpack_require__.c = installedModules;
72
/******/ // __webpack_public_path__
73
/******/ __webpack_require__.p = "";
75
/******/ // Load entry module and return exports
76
/******/ return __webpack_require__(0);
78
/************************************************************************/
81
/***/ function(module, exports, __webpack_require__) {
85
var _interopRequireWildcard = __webpack_require__(1)['default'];
87
var _interopRequireDefault = __webpack_require__(2)['default'];
89
exports.__esModule = true;
91
var _handlebarsBase = __webpack_require__(3);
93
var base = _interopRequireWildcard(_handlebarsBase);
95
// Each of these augment the Handlebars object. No need to setup here.
96
// (This is done to easily share code between commonjs and browse envs)
98
var _handlebarsSafeString = __webpack_require__(17);
100
var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString);
102
var _handlebarsException = __webpack_require__(5);
104
var _handlebarsException2 = _interopRequireDefault(_handlebarsException);
106
var _handlebarsUtils = __webpack_require__(4);
108
var Utils = _interopRequireWildcard(_handlebarsUtils);
110
var _handlebarsRuntime = __webpack_require__(18);
112
var runtime = _interopRequireWildcard(_handlebarsRuntime);
114
var _handlebarsNoConflict = __webpack_require__(19);
116
var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict);
118
// For compatibility and usage outside of module systems, make the Handlebars object a namespace
120
var hb = new base.HandlebarsEnvironment();
122
Utils.extend(hb, base);
123
hb.SafeString = _handlebarsSafeString2['default'];
124
hb.Exception = _handlebarsException2['default'];
126
hb.escapeExpression = Utils.escapeExpression;
129
hb.template = function (spec) {
130
return runtime.template(spec, hb);
137
inst.create = create;
139
_handlebarsNoConflict2['default'](inst);
141
inst['default'] = inst;
143
exports['default'] = inst;
144
module.exports = exports['default'];
148
/***/ function(module, exports) {
152
exports["default"] = function (obj) {
153
if (obj && obj.__esModule) {
159
for (var key in obj) {
160
if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
164
newObj["default"] = obj;
169
exports.__esModule = true;
173
/***/ function(module, exports) {
177
exports["default"] = function (obj) {
178
return obj && obj.__esModule ? obj : {
183
exports.__esModule = true;
187
/***/ function(module, exports, __webpack_require__) {
191
var _interopRequireDefault = __webpack_require__(2)['default'];
193
exports.__esModule = true;
194
exports.HandlebarsEnvironment = HandlebarsEnvironment;
196
var _utils = __webpack_require__(4);
198
var _exception = __webpack_require__(5);
200
var _exception2 = _interopRequireDefault(_exception);
202
var _helpers = __webpack_require__(6);
204
var _decorators = __webpack_require__(14);
206
var _logger = __webpack_require__(16);
208
var _logger2 = _interopRequireDefault(_logger);
210
var VERSION = '4.0.5';
211
exports.VERSION = VERSION;
212
var COMPILER_REVISION = 7;
214
exports.COMPILER_REVISION = COMPILER_REVISION;
215
var REVISION_CHANGES = {
216
1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
220
5: '== 2.0.0-alpha.x',
221
6: '>= 2.0.0-beta.1',
225
exports.REVISION_CHANGES = REVISION_CHANGES;
226
var objectType = '[object Object]';
228
function HandlebarsEnvironment(helpers, partials, decorators) {
229
this.helpers = helpers || {};
230
this.partials = partials || {};
231
this.decorators = decorators || {};
233
_helpers.registerDefaultHelpers(this);
234
_decorators.registerDefaultDecorators(this);
237
HandlebarsEnvironment.prototype = {
238
constructor: HandlebarsEnvironment,
240
logger: _logger2['default'],
241
log: _logger2['default'].log,
243
registerHelper: function registerHelper(name, fn) {
244
if (_utils.toString.call(name) === objectType) {
246
throw new _exception2['default']('Arg not supported with multiple helpers');
248
_utils.extend(this.helpers, name);
250
this.helpers[name] = fn;
253
unregisterHelper: function unregisterHelper(name) {
254
delete this.helpers[name];
257
registerPartial: function registerPartial(name, partial) {
258
if (_utils.toString.call(name) === objectType) {
259
_utils.extend(this.partials, name);
261
if (typeof partial === 'undefined') {
262
throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined');
264
this.partials[name] = partial;
267
unregisterPartial: function unregisterPartial(name) {
268
delete this.partials[name];
271
registerDecorator: function registerDecorator(name, fn) {
272
if (_utils.toString.call(name) === objectType) {
274
throw new _exception2['default']('Arg not supported with multiple decorators');
276
_utils.extend(this.decorators, name);
278
this.decorators[name] = fn;
281
unregisterDecorator: function unregisterDecorator(name) {
282
delete this.decorators[name];
286
var log = _logger2['default'].log;
289
exports.createFrame = _utils.createFrame;
290
exports.logger = _logger2['default'];
294
/***/ function(module, exports) {
298
exports.__esModule = true;
299
exports.extend = extend;
300
exports.indexOf = indexOf;
301
exports.escapeExpression = escapeExpression;
302
exports.isEmpty = isEmpty;
303
exports.createFrame = createFrame;
304
exports.blockParams = blockParams;
305
exports.appendContextPath = appendContextPath;
316
var badChars = /[&<>"'`=]/g,
317
possible = /[&<>"'`=]/;
319
function escapeChar(chr) {
323
function extend(obj /* , ...source */) {
324
for (var i = 1; i < arguments.length; i++) {
325
for (var key in arguments[i]) {
326
if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
327
obj[key] = arguments[i][key];
335
var toString = Object.prototype.toString;
337
exports.toString = toString;
338
// Sourced from lodash
339
// https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
340
/* eslint-disable func-style */
341
var isFunction = function isFunction(value) {
342
return typeof value === 'function';
344
// fallback for older versions of Chrome and Safari
345
/* istanbul ignore next */
346
if (isFunction(/x/)) {
347
exports.isFunction = isFunction = function (value) {
348
return typeof value === 'function' && toString.call(value) === '[object Function]';
351
exports.isFunction = isFunction;
353
/* eslint-enable func-style */
355
/* istanbul ignore next */
356
var isArray = Array.isArray || function (value) {
357
return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false;
360
exports.isArray = isArray;
361
// Older IE versions do not directly support indexOf so we must implement our own, sadly.
363
function indexOf(array, value) {
364
for (var i = 0, len = array.length; i < len; i++) {
365
if (array[i] === value) {
372
function escapeExpression(string) {
373
if (typeof string !== 'string') {
374
// don't escape SafeStrings, since they're already safe
375
if (string && string.toHTML) {
376
return string.toHTML();
377
} else if (string == null) {
379
} else if (!string) {
383
// Force a string conversion as this will be done by the append regardless and
384
// the regex test will do this transparently behind the scenes, causing issues if
385
// an object's to string has escaped characters in it.
386
string = '' + string;
389
if (!possible.test(string)) {
392
return string.replace(badChars, escapeChar);
395
function isEmpty(value) {
396
if (!value && value !== 0) {
398
} else if (isArray(value) && value.length === 0) {
405
function createFrame(object) {
406
var frame = extend({}, object);
407
frame._parent = object;
411
function blockParams(params, ids) {
416
function appendContextPath(contextPath, id) {
417
return (contextPath ? contextPath + '.' : '') + id;
422
/***/ function(module, exports) {
426
exports.__esModule = true;
428
var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
430
function Exception(message, node) {
431
var loc = node && node.loc,
435
line = loc.start.line;
436
column = loc.start.column;
438
message += ' - ' + line + ':' + column;
441
var tmp = Error.prototype.constructor.call(this, message);
443
// Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
444
for (var idx = 0; idx < errorProps.length; idx++) {
445
this[errorProps[idx]] = tmp[errorProps[idx]];
448
/* istanbul ignore else */
449
if (Error.captureStackTrace) {
450
Error.captureStackTrace(this, Exception);
454
this.lineNumber = line;
455
this.column = column;
459
Exception.prototype = new Error();
461
exports['default'] = Exception;
462
module.exports = exports['default'];
466
/***/ function(module, exports, __webpack_require__) {
470
var _interopRequireDefault = __webpack_require__(2)['default'];
472
exports.__esModule = true;
473
exports.registerDefaultHelpers = registerDefaultHelpers;
475
var _helpersBlockHelperMissing = __webpack_require__(7);
477
var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing);
479
var _helpersEach = __webpack_require__(8);
481
var _helpersEach2 = _interopRequireDefault(_helpersEach);
483
var _helpersHelperMissing = __webpack_require__(9);
485
var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing);
487
var _helpersIf = __webpack_require__(10);
489
var _helpersIf2 = _interopRequireDefault(_helpersIf);
491
var _helpersLog = __webpack_require__(11);
493
var _helpersLog2 = _interopRequireDefault(_helpersLog);
495
var _helpersLookup = __webpack_require__(12);
497
var _helpersLookup2 = _interopRequireDefault(_helpersLookup);
499
var _helpersWith = __webpack_require__(13);
501
var _helpersWith2 = _interopRequireDefault(_helpersWith);
503
function registerDefaultHelpers(instance) {
504
_helpersBlockHelperMissing2['default'](instance);
505
_helpersEach2['default'](instance);
506
_helpersHelperMissing2['default'](instance);
507
_helpersIf2['default'](instance);
508
_helpersLog2['default'](instance);
509
_helpersLookup2['default'](instance);
510
_helpersWith2['default'](instance);
515
/***/ function(module, exports, __webpack_require__) {
519
exports.__esModule = true;
521
var _utils = __webpack_require__(4);
523
exports['default'] = function (instance) {
524
instance.registerHelper('blockHelperMissing', function (context, options) {
525
var inverse = options.inverse,
528
if (context === true) {
530
} else if (context === false || context == null) {
531
return inverse(this);
532
} else if (_utils.isArray(context)) {
533
if (context.length > 0) {
535
options.ids = [options.name];
538
return instance.helpers.each(context, options);
540
return inverse(this);
543
if (options.data && options.ids) {
544
var data = _utils.createFrame(options.data);
545
data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name);
546
options = { data: data };
549
return fn(context, options);
554
module.exports = exports['default'];
558
/***/ function(module, exports, __webpack_require__) {
562
var _interopRequireDefault = __webpack_require__(2)['default'];
564
exports.__esModule = true;
566
var _utils = __webpack_require__(4);
568
var _exception = __webpack_require__(5);
570
var _exception2 = _interopRequireDefault(_exception);
572
exports['default'] = function (instance) {
573
instance.registerHelper('each', function (context, options) {
575
throw new _exception2['default']('Must pass iterator to #each');
579
inverse = options.inverse,
583
contextPath = undefined;
585
if (options.data && options.ids) {
586
contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';
589
if (_utils.isFunction(context)) {
590
context = context.call(this);
594
data = _utils.createFrame(options.data);
597
function execIteration(field, index, last) {
601
data.first = index === 0;
605
data.contextPath = contextPath + field;
609
ret = ret + fn(context[field], {
611
blockParams: _utils.blockParams([context[field], field], [contextPath + field, null])
615
if (context && typeof context === 'object') {
616
if (_utils.isArray(context)) {
617
for (var j = context.length; i < j; i++) {
619
execIteration(i, i, i === context.length - 1);
623
var priorKey = undefined;
625
for (var key in context) {
626
if (context.hasOwnProperty(key)) {
627
// We're running the iterations one step out of sync so we can detect
628
// the last iteration without have to scan the object twice and create
629
// an itermediate keys array.
630
if (priorKey !== undefined) {
631
execIteration(priorKey, i - 1);
637
if (priorKey !== undefined) {
638
execIteration(priorKey, i - 1, true);
651
module.exports = exports['default'];
655
/***/ function(module, exports, __webpack_require__) {
659
var _interopRequireDefault = __webpack_require__(2)['default'];
661
exports.__esModule = true;
663
var _exception = __webpack_require__(5);
665
var _exception2 = _interopRequireDefault(_exception);
667
exports['default'] = function (instance) {
668
instance.registerHelper('helperMissing', function () /* [args, ]options */{
669
if (arguments.length === 1) {
670
// A missing field in a {{foo}} construct.
673
// Someone is actually trying to call something, blow up.
674
throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"');
679
module.exports = exports['default'];
683
/***/ function(module, exports, __webpack_require__) {
687
exports.__esModule = true;
689
var _utils = __webpack_require__(4);
691
exports['default'] = function (instance) {
692
instance.registerHelper('if', function (conditional, options) {
693
if (_utils.isFunction(conditional)) {
694
conditional = conditional.call(this);
697
// Default behavior is to render the positive path if the value is truthy and not empty.
698
// The `includeZero` option may be set to treat the condtional as purely not empty based on the
699
// behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
700
if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) {
701
return options.inverse(this);
703
return options.fn(this);
707
instance.registerHelper('unless', function (conditional, options) {
708
return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash });
712
module.exports = exports['default'];
716
/***/ function(module, exports) {
720
exports.__esModule = true;
722
exports['default'] = function (instance) {
723
instance.registerHelper('log', function () /* message, options */{
724
var args = [undefined],
725
options = arguments[arguments.length - 1];
726
for (var i = 0; i < arguments.length - 1; i++) {
727
args.push(arguments[i]);
731
if (options.hash.level != null) {
732
level = options.hash.level;
733
} else if (options.data && options.data.level != null) {
734
level = options.data.level;
738
instance.log.apply(instance, args);
742
module.exports = exports['default'];
746
/***/ function(module, exports) {
750
exports.__esModule = true;
752
exports['default'] = function (instance) {
753
instance.registerHelper('lookup', function (obj, field) {
754
return obj && obj[field];
758
module.exports = exports['default'];
762
/***/ function(module, exports, __webpack_require__) {
766
exports.__esModule = true;
768
var _utils = __webpack_require__(4);
770
exports['default'] = function (instance) {
771
instance.registerHelper('with', function (context, options) {
772
if (_utils.isFunction(context)) {
773
context = context.call(this);
778
if (!_utils.isEmpty(context)) {
779
var data = options.data;
780
if (options.data && options.ids) {
781
data = _utils.createFrame(options.data);
782
data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]);
787
blockParams: _utils.blockParams([context], [data && data.contextPath])
790
return options.inverse(this);
795
module.exports = exports['default'];
799
/***/ function(module, exports, __webpack_require__) {
803
var _interopRequireDefault = __webpack_require__(2)['default'];
805
exports.__esModule = true;
806
exports.registerDefaultDecorators = registerDefaultDecorators;
808
var _decoratorsInline = __webpack_require__(15);
810
var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline);
812
function registerDefaultDecorators(instance) {
813
_decoratorsInline2['default'](instance);
818
/***/ function(module, exports, __webpack_require__) {
822
exports.__esModule = true;
824
var _utils = __webpack_require__(4);
826
exports['default'] = function (instance) {
827
instance.registerDecorator('inline', function (fn, props, container, options) {
829
if (!props.partials) {
831
ret = function (context, options) {
832
// Create a new partials stack frame prior to exec.
833
var original = container.partials;
834
container.partials = _utils.extend({}, original, props.partials);
835
var ret = fn(context, options);
836
container.partials = original;
841
props.partials[options.args[0]] = options.fn;
847
module.exports = exports['default'];
851
/***/ function(module, exports, __webpack_require__) {
855
exports.__esModule = true;
857
var _utils = __webpack_require__(4);
860
methodMap: ['debug', 'info', 'warn', 'error'],
863
// Maps a given level value to the `methodMap` indexes above.
864
lookupLevel: function lookupLevel(level) {
865
if (typeof level === 'string') {
866
var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase());
870
level = parseInt(level, 10);
877
// Can be overridden in the host environment
878
log: function log(level) {
879
level = logger.lookupLevel(level);
881
if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) {
882
var method = logger.methodMap[level];
883
if (!console[method]) {
884
// eslint-disable-line no-console
888
for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
889
message[_key - 1] = arguments[_key];
892
console[method].apply(console, message); // eslint-disable-line no-console
897
exports['default'] = logger;
898
module.exports = exports['default'];
902
/***/ function(module, exports) {
904
// Build out our basic SafeString type
907
exports.__esModule = true;
908
function SafeString(string) {
909
this.string = string;
912
SafeString.prototype.toString = SafeString.prototype.toHTML = function () {
913
return '' + this.string;
916
exports['default'] = SafeString;
917
module.exports = exports['default'];
921
/***/ function(module, exports, __webpack_require__) {
925
var _interopRequireWildcard = __webpack_require__(1)['default'];
927
var _interopRequireDefault = __webpack_require__(2)['default'];
929
exports.__esModule = true;
930
exports.checkRevision = checkRevision;
931
exports.template = template;
932
exports.wrapProgram = wrapProgram;
933
exports.resolvePartial = resolvePartial;
934
exports.invokePartial = invokePartial;
937
var _utils = __webpack_require__(4);
939
var Utils = _interopRequireWildcard(_utils);
941
var _exception = __webpack_require__(5);
943
var _exception2 = _interopRequireDefault(_exception);
945
var _base = __webpack_require__(3);
947
function checkRevision(compilerInfo) {
948
var compilerRevision = compilerInfo && compilerInfo[0] || 1,
949
currentRevision = _base.COMPILER_REVISION;
951
if (compilerRevision !== currentRevision) {
952
if (compilerRevision < currentRevision) {
953
var runtimeVersions = _base.REVISION_CHANGES[currentRevision],
954
compilerVersions = _base.REVISION_CHANGES[compilerRevision];
955
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 + ').');
957
// Use the embedded version info since the runtime doesn't know about this revision yet
958
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] + ').');
963
function template(templateSpec, env) {
964
/* istanbul ignore next */
966
throw new _exception2['default']('No environment passed to template');
968
if (!templateSpec || !templateSpec.main) {
969
throw new _exception2['default']('Unknown template object: ' + typeof templateSpec);
972
templateSpec.main.decorator = templateSpec.main_d;
974
// Note: Using env.VM references rather than local var references throughout this section to allow
975
// for external users to override these as psuedo-supported APIs.
976
env.VM.checkRevision(templateSpec.compiler);
978
function invokePartialWrapper(partial, context, options) {
980
context = Utils.extend({}, context, options.hash);
982
options.ids[0] = true;
986
partial = env.VM.resolvePartial.call(this, partial, context, options);
987
var result = env.VM.invokePartial.call(this, partial, context, options);
989
if (result == null && env.compile) {
990
options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env);
991
result = options.partials[options.name](context, options);
993
if (result != null) {
994
if (options.indent) {
995
var lines = result.split('\n');
996
for (var i = 0, l = lines.length; i < l; i++) {
997
if (!lines[i] && i + 1 === l) {
1001
lines[i] = options.indent + lines[i];
1003
result = lines.join('\n');
1007
throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode');
1013
strict: function strict(obj, name) {
1014
if (!(name in obj)) {
1015
throw new _exception2['default']('"' + name + '" not defined in ' + obj);
1019
lookup: function lookup(depths, name) {
1020
var len = depths.length;
1021
for (var i = 0; i < len; i++) {
1022
if (depths[i] && depths[i][name] != null) {
1023
return depths[i][name];
1027
lambda: function lambda(current, context) {
1028
return typeof current === 'function' ? current.call(context) : current;
1031
escapeExpression: Utils.escapeExpression,
1032
invokePartial: invokePartialWrapper,
1034
fn: function fn(i) {
1035
var ret = templateSpec[i];
1036
ret.decorator = templateSpec[i + '_d'];
1041
program: function program(i, data, declaredBlockParams, blockParams, depths) {
1042
var programWrapper = this.programs[i],
1044
if (data || depths || blockParams || declaredBlockParams) {
1045
programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths);
1046
} else if (!programWrapper) {
1047
programWrapper = this.programs[i] = wrapProgram(this, i, fn);
1049
return programWrapper;
1052
data: function data(value, depth) {
1053
while (value && depth--) {
1054
value = value._parent;
1058
merge: function merge(param, common) {
1059
var obj = param || common;
1061
if (param && common && param !== common) {
1062
obj = Utils.extend({}, common, param);
1069
compilerInfo: templateSpec.compiler
1072
function ret(context) {
1073
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
1075
var data = options.data;
1077
ret._setup(options);
1078
if (!options.partial && templateSpec.useData) {
1079
data = initData(context, data);
1081
var depths = undefined,
1082
blockParams = templateSpec.useBlockParams ? [] : undefined;
1083
if (templateSpec.useDepths) {
1084
if (options.depths) {
1085
depths = context !== options.depths[0] ? [context].concat(options.depths) : options.depths;
1091
function main(context /*, options*/) {
1092
return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths);
1094
main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams);
1095
return main(context, options);
1099
ret._setup = function (options) {
1100
if (!options.partial) {
1101
container.helpers = container.merge(options.helpers, env.helpers);
1103
if (templateSpec.usePartial) {
1104
container.partials = container.merge(options.partials, env.partials);
1106
if (templateSpec.usePartial || templateSpec.useDecorators) {
1107
container.decorators = container.merge(options.decorators, env.decorators);
1110
container.helpers = options.helpers;
1111
container.partials = options.partials;
1112
container.decorators = options.decorators;
1116
ret._child = function (i, data, blockParams, depths) {
1117
if (templateSpec.useBlockParams && !blockParams) {
1118
throw new _exception2['default']('must pass block params');
1120
if (templateSpec.useDepths && !depths) {
1121
throw new _exception2['default']('must pass parent depths');
1124
return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths);
1129
function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) {
1130
function prog(context) {
1131
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
1133
var currentDepths = depths;
1134
if (depths && context !== depths[0]) {
1135
currentDepths = [context].concat(depths);
1138
return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths);
1141
prog = executeDecorators(fn, prog, container, depths, data, blockParams);
1144
prog.depth = depths ? depths.length : 0;
1145
prog.blockParams = declaredBlockParams || 0;
1149
function resolvePartial(partial, context, options) {
1151
if (options.name === '@partial-block') {
1152
partial = options.data['partial-block'];
1154
partial = options.partials[options.name];
1156
} else if (!partial.call && !options.name) {
1157
// This is a dynamic partial that returned a string
1158
options.name = partial;
1159
partial = options.partials[partial];
1164
function invokePartial(partial, context, options) {
1165
options.partial = true;
1167
options.data.contextPath = options.ids[0] || options.data.contextPath;
1170
var partialBlock = undefined;
1171
if (options.fn && options.fn !== noop) {
1172
options.data = _base.createFrame(options.data);
1173
partialBlock = options.data['partial-block'] = options.fn;
1175
if (partialBlock.partials) {
1176
options.partials = Utils.extend({}, options.partials, partialBlock.partials);
1180
if (partial === undefined && partialBlock) {
1181
partial = partialBlock;
1184
if (partial === undefined) {
1185
throw new _exception2['default']('The partial ' + options.name + ' could not be found');
1186
} else if (partial instanceof Function) {
1187
return partial(context, options);
1195
function initData(context, data) {
1196
if (!data || !('root' in data)) {
1197
data = data ? _base.createFrame(data) : {};
1198
data.root = context;
1203
function executeDecorators(fn, prog, container, depths, data, blockParams) {
1206
prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths);
1207
Utils.extend(prog, props);
1214
/***/ function(module, exports) {
1216
/* WEBPACK VAR INJECTION */(function(global) {/* global window */
1219
exports.__esModule = true;
1221
exports['default'] = function (Handlebars) {
1222
/* istanbul ignore next */
1223
var root = typeof global !== 'undefined' ? global : window,
1224
$Handlebars = root.Handlebars;
1225
/* istanbul ignore next */
1226
Handlebars.noConflict = function () {
1227
if (root.Handlebars === Handlebars) {
1228
root.Handlebars = $Handlebars;
1234
module.exports = exports['default'];
1235
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
b'\\ No newline at end of file'