@ -1,8 +1,8 @@
/ * !
handlebars v 1. 3.0
handlebars v 3. 0.2
Copyright ( C ) 2011 by Yehuda Katz
Copyright ( C ) 2011 - 2014 by Yehuda Katz
Permission is hereby granted , free of charge , to any person obtaining a copy
of this software and associated documentation files ( the "Software" ) , to deal
@ -24,91 +24,105 @@ THE SOFTWARE.
@ license
* /
define ( 'handlebars/utils' , [ 'exports' ] , function ( exports ) {
define (
'handlebars/safe-string' , [ "exports" ] ,
function ( _ _exports _ _ ) {
// Build out our basic SafeString type
function SafeString ( string ) {
this . string = string ;
}
SafeString . prototype . toString = function ( ) {
return "" + this . string ;
} ;
_ _exports _ _ [ "default" ] = SafeString ;
} ) ;
define (
'handlebars/utils' , [ "./safe-string" , "exports" ] ,
function ( _ _dependency1 _ _ , _ _exports _ _ ) {
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 SafeString = _ _dependency1 _ _ [ "default" ] ;
var escape = {
"&" : "&" ,
"<" : "<" ,
">" : ">" ,
'"' : """ ,
"'" : "'" ,
"`" : "`"
'&' : '&' ,
'<' : '<' ,
'>' : '>' ,
'"' : '"' ,
'\'' : ''' ,
'`' : '`'
} ;
var badChars = /[&<>"'`]/g ;
var possible = /[&<>"'`]/ ;
var badChars = /[&<>"'`]/g ,
possible = /[&<>"'`]/ ;
function escapeChar ( chr ) {
return escape [ chr ] || "&" ;
return escape [ chr ] ;
}
function extend ( obj , value ) {
for ( var key in value ) {
if ( Object . prototype . hasOwnProperty . call ( value , key ) ) {
obj [ key ] = value [ key ] ;
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 ;
}
_ _exports _ _ . extend = extend ; var toString = Object . prototype . toString ;
_ _exports _ _ . toString = 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' ;
} ;
// fallback for older versions of Chrome and Safari
/* istanbul ignore next */
if ( isFunction ( /x/ ) ) {
isFunction = function ( value ) {
exports . isFunction = isFunction = function ( value ) {
return typeof value === 'function' && toString . call ( value ) === '[object Function]' ;
} ;
}
var isFunction ;
_ _exports _ _ . isFunction = isFunction ;
var isArray = Array . isArray || function ( value ) {
return ( value && typeof value === 'object' ) ? toString . call ( value ) === '[object Array]' : false ;
} ;
_ _exports _ _ . isArray = isArray ;
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 instanceof SafeString ) {
return string . toString ( ) ;
} else if ( ! string && string !== 0 ) {
return "" ;
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 ;
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 ) {
return true ;
} else if ( isArray ( value ) && value . length === 0 ) {
@ -118,21 +132,29 @@ define(
}
}
_ _exports _ _ . isEmpty = isEmpty ;
} ) ;
define (
'handlebars/exception' , [ "exports" ] ,
function ( _ _exports _ _ ) {
function blockParams ( params , ids ) {
params . path = ids ;
return params ;
}
function appendContextPath ( contextPath , id ) {
return ( contextPath ? contextPath + '.' : '' ) + id ;
}
} ) ;
define ( 'handlebars/exception' , [ 'exports' , 'module' ] , function ( exports , module ) {
var errorProps = [ 'description' , 'fileName' , 'lineNumber' , 'message' , 'name' , 'number' , 'stack' ] ;
function Exception ( message , node ) {
var line ;
if ( node && node . firstLine ) {
line = node . firstLine ;
var loc = node && node . loc ,
line = undefined ,
column = undefined ;
if ( loc ) {
line = loc . start . line ;
column = loc . start . column ;
message += ' - ' + line + ':' + node . firstColumn ;
message += ' - ' + line + ':' + c olumn;
}
var tmp = Error . prototype . constructor . call ( this , message ) ;
@ -142,36 +164,49 @@ define(
this [ errorProps [ idx ] ] = tmp [ errorProps [ idx ] ] ;
}
if ( line ) {
if ( Error . captureStackTrace ) {
Error . captureStackTrace ( this , Exception ) ;
}
if ( loc ) {
this . lineNumber = line ;
this . column = node . firstColumn ;
this . column = c olumn;
}
}
Exception . prototype = new Error ( ) ;
_ _exports _ _ [ "default" ] = Exception ;
} ) ;
define (
'handlebars/base' , [ "./utils" , "./exception" , "exports" ] ,
function ( _ _dependency1 _ _ , _ _dependency2 _ _ , _ _exports _ _ ) {
module . exports = Exception ;
} ) ;
define ( 'handlebars/base' , [ 'exports' , './utils' , './exception' ] , function ( exports , _utils , _exception ) {
var _interopRequire = function ( obj ) { return obj && obj . _ _esModule ? obj [ 'default' ] : obj ; } ;
var Utils = _ _dependency1 _ _ ;
var Exception = _ _dependency2 _ _ [ "default" ] ;
exports . _ _esModule = true ;
exports . HandlebarsEnvironment = HandlebarsEnvironment ;
exports . createFrame = createFrame ;
var VERSION = "1.3.0" ;
_ _exports _ _ . VERSION = VERSION ; var COMPILER _REVISION = 4 ;
_ _exports _ _ . COMPILER _REVISION = COMPILER _REVISION ;
var _Exception = _interopRequire ( _exception ) ;
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.0.0'
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 ,
exports . REVISION _CHANGES = REVISION _CHANGES ;
var isArray = _utils . isArray ,
isFunction = _utils . isFunction ,
toString = _utils . toString ,
objectType = '[object Object]' ;
function HandlebarsEnvironment ( helpers , partials ) {
@ -181,128 +216,202 @@ define(
registerDefaultHelpers ( this ) ;
}
_ _exports _ _ . HandlebarsEnvironment = HandlebarsEnvironment ; HandlebarsEnvironment . prototype = {
HandlebarsEnvironment . prototype = {
constructor : HandlebarsEnvironment ,
logger : logger ,
log : log ,
registerHelper : function ( name , fn , inverse ) {
registerHelper : function registerHelper ( name , fn ) {
if ( toString . call ( name ) === objectType ) {
if ( inverse || fn ) { throw new Exception ( 'Arg not supported with multiple helpers' ) ; }
Utils . extend ( this . helpers , name ) ;
if ( fn ) {
throw new _Exception ( 'Arg not supported with multiple helpers' ) ;
}
_utils . extend ( this . helpers , name ) ;
} else {
if ( inverse ) { fn . not = inverse ; }
this . helpers [ name ] = fn ;
}
} ,
unregisterHelper : function unregisterHelper ( name ) {
delete this . helpers [ name ] ;
} ,
registerPartial : function ( name , str ) {
registerPartial : function registerPartial ( name , partial ) {
if ( toString . call ( name ) === objectType ) {
U tils. extend ( this . partials , name ) ;
_u tils. extend ( this . partials , name ) ;
} else {
this . partials [ name ] = str ;
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 ] ;
}
} ;
function registerDefaultHelpers ( instance ) {
instance . registerHelper ( 'helperMissing' , function ( arg ) {
if ( arguments . length === 2 ) {
instance . registerHelper ( 'helperMissing' , function ( ) {
if ( arguments . length === 1 ) {
// A missing field in a {{foo}} constuct.
return undefined ;
} else {
throw new Exception ( "Missing helper: '" + arg + "'" ) ;
// Someone is actually trying to call something, blow up.
throw new _Exception ( 'Missing helper: "' + arguments [ arguments . length - 1 ] . name + '"' ) ;
}
} ) ;
instance . registerHelper ( 'blockHelperMissing' , function ( context , options ) {
var inverse = options . inverse || function ( ) { } , fn = options . fn ;
instance . registerHelper ( 'blockHelperMissing' , function ( context , options ) {
var inverse = options . inverse ,
fn = options . fn ;
if ( isFunction ( context ) ) { context = context . call ( this ) ; }
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 ) {
options . ids = [ options . name ] ;
}
return instance . helpers . each ( context , options ) ;
} else {
return inverse ( this ) ;
}
} else {
return fn ( context ) ;
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 ) ;
}
} ) ;
instance . registerHelper ( 'each' , function ( context , options ) {
var fn = options . fn , inverse = options . inverse ;
var i = 0 , ret = "" , data ;
instance . registerHelper ( 'each' , function ( context , options ) {
if ( ! options ) {
throw new _Exception ( 'Must pass iterator to #each' ) ;
}
var fn = options . fn ,
inverse = options . inverse ,
i = 0 ,
ret = '' ,
data = undefined ,
contextPath = undefined ;
if ( isFunction ( context ) ) { context = context . call ( this ) ; }
if ( options . data && options . ids ) {
contextPath = _utils . appendContextPath ( options . data . contextPath , options . ids [ 0 ] ) + '.' ;
}
if ( isFunction ( context ) ) {
context = context . call ( this ) ;
}
if ( options . data ) {
data = createFrame ( options . data ) ;
}
if ( context && typeof context === 'object' ) {
if ( isArray ( context ) ) {
for ( var j = context . length ; i < j ; i ++ ) {
function execIteration ( field , index , last ) {
if ( data ) {
data . index = i ;
data . first = ( i === 0 ) ;
data . last = ( i === ( context . length - 1 ) ) ;
data . key = field ;
data . index = index ;
data . first = index === 0 ;
data . last = ! ! last ;
if ( contextPath ) {
data . contextPath = contextPath + field ;
}
ret = ret + fn ( context [ i ] , { data : data } ) ;
}
ret = ret + fn ( context [ field ] , {
data : data ,
blockParams : _utils . blockParams ( [ context [ field ] , field ] , [ contextPath + field , 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 {
for ( var key in context ) {
if ( context . hasOwnProperty ( key ) ) {
if ( data ) {
data . key = key ;
data . index = i ;
data . first = ( i === 0 ) ;
}
ret = ret + fn ( context [ key ] , { data : data } ) ;
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 ( i === 0 ) {
if ( i === 0 ) {
ret = inverse ( this ) ;
}
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 ) || U tils. isEmpty ( conditional ) ) {
if ( ! options . hash . includeZero && ! conditional || _u tils. 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 ;
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 } ;
}
if ( ! Utils . isEmpty ( context ) ) return options . fn ( context ) ;
return fn ( context , options ) ;
} else {
return options . inverse ( this ) ;
}
} ) ;
instance . registerHelper ( 'log' , function ( context , options ) {
instance . registerHelper ( 'log' , function ( message , options ) {
var level = options . data && options . data . level != null ? parseInt ( options . data . level , 10 ) : 1 ;
instance . log ( level , context ) ;
instance . log ( level , message ) ;
} ) ;
instance . registerHelper ( 'lookup' , function ( obj , field ) {
return obj && obj [ field ] ;
} ) ;
}
@ -314,202 +423,315 @@ define(
INFO : 1 ,
WARN : 2 ,
ERROR : 3 ,
level : 3 ,
level : 1 ,
// c an be overridden in the host environment
log : function ( level , obj ) {
if ( logger . level <= level ) {
// C an be overridden in the host environment
log : function log ( level , message ) {
if ( typeof console !== 'undefined' && logger . level <= level ) {
var method = logger . methodMap [ level ] ;
if ( typeof console !== 'undefined' && console [ method ] ) {
console [ method ] . call ( console , obj ) ;
}
( console [ method ] || console . log ) . call ( console , message ) ; // eslint-disable-line no-console
}
}
} ;
_ _exports _ _ . logger = logger ;
function log ( level , obj ) { logger . log ( level , obj ) ; }
_ _exports _ _ . log = log ; var createFrame = function ( object ) {
var obj = { } ;
Utils . extend ( obj , object ) ;
return obj ;
exports . logger = logger ;
var log = logger . log ;
exports . log = log ;
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
function SafeString ( string ) {
this . string = string ;
}
SafeString . prototype . toString = SafeString . prototype . toHTML = function ( ) {
return '' + this . string ;
} ;
_ _exports _ _ . createFrame = createFrame ;
} ) ;
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 ;
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 = COMPILER _REVISION ;
currentRevision = _base . 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 = _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 ] + ")." ) ;
throw new _Exception ( 'Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo [ 1 ] + ').' ) ;
}
}
}
_ _exports _ _ . checkRevision = checkRevision ; // TODO: Remove this line and break up compilePartial
function template ( templateSpec , env ) {
/* istanbul ignore next */
if ( ! env ) {
throw new Exception ( "No environment passed to template" ) ;
throw new _Exception ( 'No environment passed to template' ) ;
}
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.
var invokePartialWrapper = function ( partial , name , context , helpers , partials , data ) {
var result = env . VM . invokePartial . apply ( this , arguments ) ;
if ( result != null ) { return result ; }
if ( env . compile ) {
var options = { helpers : helpers , partials : partials , data : data } ;
partials [ name ] = env . compile ( partial , { data : data !== undefined } , env ) ;
return partials [ name ] ( context , options ) ;
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 Exception ( "The partial " + 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 = {
escapeExpression : Utils . escapeExpression ,
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 ] ;
}
}
} ,
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 ( i , fn , data ) {
var programWrapper = this . programs [ i ] ;
if ( data ) {
programWrapper = program ( i , fn , data ) ;
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 ] = program ( i , fn ) ;
programWrapper = this . programs [ i ] = wra pP rogram( this , i , fn ) ;
}
return programWrapper ;
} ,
merge : function ( param , common ) {
var ret = param || common ;
if ( param && common && ( param !== common ) ) {
ret = { } ;
Utils . extend ( ret , common ) ;
Utils . extend ( ret , param ) ;
data : function data ( value , depth ) {
while ( value && depth -- ) {
value = value . _parent ;
}
return ret ;
return value ;
} ,
programWithDepth : env . VM . programWithDepth ,
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 : null
compilerInfo : templateSpec . compiler
} ;
return function ( context , options ) {
options = options || { } ;
var namespace = options . partial ? options : env ,
helpers ,
partials ;
function ret ( context ) {
var options = arguments [ 1 ] === undefined ? { } : arguments [ 1 ] ;
if ( ! options . partial ) {
helpers = options . helpers ;
partials = options . partials ;
}
var result = templateSpec . call (
container ,
namespace , context ,
helpers ,
partials ,
options . data ) ;
var data = options . data ;
if ( ! options . partial ) {
env . VM . checkRevision ( container . compilerInfo ) ;
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 result ;
} ;
return templateSpec . main . call ( container , context , container . helpers , container . partials , data , blockParams , depths ) ;
}
ret . isTop = true ;
_ _exports _ _ . template = template ; function programWithDepth ( i , fn , data /*, $depth */ ) {
var args = Array . prototype . slice . call ( arguments , 3 ) ;
ret . _setup = function ( options ) {
if ( ! options . partial ) {
container . helpers = container . merge ( options . helpers , env . helpers ) ;
var prog = function ( context , options ) {
options = options || { } ;
if ( templateSpec . usePartial ) {
container . partials = container . merge ( options . partials , env . partials ) ;
}
} else {
container . helpers = options . helpers ;
container . partials = options . partials ;
}
} ;
return fn . apply ( this , [ context , options . data || data ] . concat ( args ) ) ;
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' ) ;
}
return wrapProgram ( container , i , templateSpec [ i ] , data , 0 , blockParams , depths ) ;
} ;
prog . program = i ;
prog . depth = args . length ;
return prog ;
return ret ;
}
_ _exports _ _ . programWithDepth = programWithDepth ; function program ( i , fn , data ) {
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 (cont ext, options. data || data ) ;
} ;
return fn .call (cont ainer, cont ext, container. helpers , container . partials , options. data || data , blockParams && [ options . blockParams ] . concat ( blockParams ) , depths && [ context ] . concat ( depths ) ) ;
}
prog . program = i ;
prog . depth = 0 ;
prog . depth = depths ? depths . length : 0 ;
prog . blockParams = declaredBlockParams || 0 ;
return prog ;
}
_ _exports _ _ . program = program ; function invokePartial ( partial , name , context , helpers , partials , data ) {
var options = { partial : true , helpers : helpers , partials : partials , data : data } ;
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 Exception ( "The partial " + 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 ) ;
}
}
_ _exports _ _ . invokePartial = invokePartial ; function noop ( ) { return "" ; }
function noop ( ) {
return '' ;
}
function initData ( context , data ) {
if ( ! data || ! ( 'root' in data ) ) {
data = data ? _base . createFrame ( data ) : { } ;
data . root = context ;
}
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 ) {
_ _exports _ _ . noop = noop ;
} ) ;
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 _ _ ;
var _interopRequire = function ( obj ) { return obj && obj . _ _esModule ? obj [ 'default' ] : obj ; } ;
// 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 _ _ ;
// For compatibility and usage outside of module systems, make the Handlebars object a namespace
var create = function ( ) {
var hb = new base . HandlebarsEnvironment ( ) ;
var _SafeString = _interopRequire ( _handlebarsSafeString ) ;
Utils . extend ( hb , base ) ;
hb . SafeString = SafeString ;
hb . Exception = Exception ;
hb . Utils = Utils ;
var _Exception = _interopRequire ( _handlebarsException ) ;
hb . VM = runtime ;
hb . template = function ( spec ) {
return runtime . template ( spec , hb ) ;
// For compatibility and usage outside of module systems, make the Handlebars object a namespace
function create ( ) {
var hb = new _handlebarsBase . HandlebarsEnvironment ( ) ;
_handlebarsUtils . extend ( hb , _handlebarsBase ) ;
hb . SafeString = _SafeString ;
hb . Exception = _Exception ;
hb . Utils = _handlebarsUtils ;
hb . escapeExpression = _handlebarsUtils . escapeExpression ;
hb . VM = _handlebarsRuntime ;
hb . template = function ( spec ) {
return _handlebarsRuntime . template ( spec , hb ) ;
} ;
return hb ;
} ;
}
var Handlebars = create ( ) ;
Handlebars . create = create ;
_ _exports _ _ [ "default" ] = Handlebars ;
} ) ;
/*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 */ ;