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

vash

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vash - npm Package Compare versions

Comparing version 0.7.10-2 to 0.7.11-3

54

build/vash-runtime-all.js
/**
* Vash - JavaScript Template Parser, v0.7.10-2
* Vash - JavaScript Template Parser, v0.7.11-3
*

@@ -167,3 +167,3 @@ * https://github.com/kirbysayshi/vash

if(
( str.test && this._vo[i].search(str) > -1 )
( str.test && this._vo[i] && this._vo[i].search(str) > -1 )
|| this._vo[i] == str

@@ -183,3 +183,3 @@ ){

if(
( str.test && this._vo[i].search(str) > -1 )
( str.test && this._vo[i] && this._vo[i].search(str) > -1 )
|| this._vo[i] == str

@@ -230,3 +230,3 @@ ){

var reMark = /\[VASHMARK\-\d{1,8}(?::[\s\S]+?)?]/g
var reMark = Mark.re = /\[VASHMARK\-\d{1,8}(?::[\s\S]+?)?]/g

@@ -260,3 +260,9 @@ // tests if a string has a mark-like uid within it

return this.markedIndex = this.buffer.indexOf( this.uid );
// The mark may be within a string due to string shenanigans. If this is
// true this is bad, because all the Mark manipulation commands assume
// that the Mark is the only content at that index in the buffer, which
// means that splice commands will result in lost content.
var escaped = this.uid.replace(/(\[|\])/g, '\\$1');
var re = new RegExp(escaped);
return this.markedIndex = this.buffer.indexOf( re );
}

@@ -646,6 +652,13 @@

// grab rendered content, immediately join to prevent needing to use
// .apply.
content = this.buffer.fromMark( m ).join('');
this.buffer.spliceMark( injectMark, 0, content );
// grab rendered content
content = this.buffer.fromMark( m )
// Join, but split out the VASHMARKS so further buffer operations are still
// sane. Join is required to prevent max argument errors when large templates
// are being used.
content = compactContent(content);
// Prep for apply, ensure the right location (mark) is used for injection.
content.unshift( injectMark, 0 );
this.buffer.spliceMark.apply( this.buffer, content );
}

@@ -669,2 +682,25 @@

// Given an array, condense all the strings to as few array elements
// as possible, while preserving `Mark`s as individual elements.
function compactContent(content) {
var re = vash.Mark.re;
var parts = [];
var str = '';
content.forEach(function(part) {
if (re.exec(part)) {
parts.push(str, part);
str = '';
} else {
// Ensure `undefined`s are not `toString`ed
str += (part || '');
}
});
// And don't forget the rest.
parts.push(str);
return parts;
}
helpers.extend = function(path, ctn){

@@ -671,0 +707,0 @@ var self = this

4

build/vash-runtime-all.min.js
/**
* Vash - JavaScript Template Parser, v0.7.10-2
* Vash - JavaScript Template Parser, v0.7.11-3
*

@@ -8,2 +8,2 @@ * https://github.com/kirbysayshi/vash

* MIT License (LICENSE)
*/void 0,function(){function i(a,b){typeof b=="function"&&(b={onRenderEnd:b}),a&&a.onRenderEnd&&(b=b||{},b.onRenderEnd||(b.onRenderEnd=a.onRenderEnd),delete a.onRenderEnd),b||(b={});return b}vash=typeof vash=="undefined"?{}:vash,vash.compile||(typeof define=="function"&&define.amd?define(function(){return vash}):typeof module=="object"&&module.exports?module.exports=vash:window.vash=vash);var a=vash.helpers,b=function(a){this.buffer=new f,this.model=a,this.options=null,this.vl=0,this.vc=0};vash.helpers=a=b.prototype={constructor:b,config:{},tplcache:{}},a.toString=a.toHtmlString=function(){return this.buffer._vo.join("")};var c=/[&<>"'`]/g,d=function(a){return e[a]},e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};a.raw=function(a){var b=function(){return a};a=a!=null?a:"";return{toHtmlString:b,toString:b}},a.escape=function(a){var b=function(){return a};a=a!=null?a:"";if(typeof a.toHtmlString!="function"){a=a.toString().replace(c,d);return{toHtmlString:b,toString:b}}return a};var f=function(){this._vo=[]};f.prototype.mark=function(a){var b=new g(this,a);b.markedIndex=this._vo.length,this._vo.push(b.uid);return b},f.prototype.fromMark=function(a){var b=a.findInBuffer();if(b>-1){a.destroy();return this._vo.splice(b,this._vo.length)}return[]},f.prototype.spliceMark=function(a,b,c){var d=a.findInBuffer();if(d>-1){a.destroy(),arguments[0]=d;return this._vo.splice.apply(this._vo,arguments)}return[]},f.prototype.empty=function(){return this._vo.splice(0,this._vo.length)},f.prototype.push=function(a){return this._vo.push(a)},f.prototype.pushConcat=function(a){var b;Array.isArray(a)?b=a:arguments.length>1?b=Array.prototype.slice.call(arguments):b=[a];for(var c=0;c<b.length;c++)this._vo.push(b[c]);return this.__vo},f.prototype.indexOf=function(a){for(var b=0;b<this._vo.length;b++)if(a.test&&this._vo[b].search(a)>-1||this._vo[b]==a)return b;return-1},f.prototype.lastIndexOf=function(a){var b=this._vo.length;while(--b>=0)if(a.test&&this._vo[b].search(a)>-1||this._vo[b]==a)return b;return-1},f.prototype.splice=function(){return this._vo.splice.apply(this._vo,arguments)},f.prototype.index=function(a){return this._vo[a]},f.prototype.flush=function(){return this.empty().join("")},f.prototype.toString=f.prototype.toHtmlString=function(){return this._vo.join("")};var g=vash.Mark=function(a,b){this.uid="[VASHMARK-"+~~(Math.random()*1e7)+(b?":"+b:"")+"]",this.markedIndex=0,this.buffer=a,this.destroyed=!1},h=/\[VASHMARK\-\d{1,8}(?::[\s\S]+?)?]/g;g.uidLike=function(a){return(a||"").search(h)>-1},g.prototype.destroy=function(){var a=this.findInBuffer();a>-1&&(this.buffer.splice(a,1),this.markedIndex=-1),this.destroyed=!0},g.prototype.findInBuffer=function(){return this.destroyed?-1:this.markedIndex&&this.buffer.index(this.markedIndex)===this.uid?this.markedIndex:this.markedIndex=this.buffer.indexOf(this.uid)},a.constructor.reportError=function(a,b,c,d,e){e=e||"!LB!";var f=d.split(e),g=b===0&&c===0?f.length-1:3,h=Math.max(0,b-g),i=Math.min(f.length,b+g),j=f.slice(h,i).map(function(a,c,d){var e=c+h+1;return(e===b?" > ":" ")+(e<10?" ":"")+e+" | "+a}).join("\n");a.vashlineno=b,a.vashcharno=c,a.message="Problem while rendering template at line "+b+", character "+c+".\nOriginal message: "+a.message+"."+"\nContext: \n\n"+j+"\n\n";throw a},a.reportError=function(){this.constructor.reportError.apply(this,arguments)},vash.link=function(c,d){var e,f;d.args||(d.args=[d.modelName,d.helpersName,"__vopts","vash"]);if(typeof c=="string"){e=c;try{f=d.args.slice(),f.push(c),c=Function.apply(null,f)}catch(g){a.reportError(g,0,0,e,/\n/)}}c.options={simple:d.simple,modelName:d.modelName,helpersName:d.helpersName};var h;d.asHelper?(c.options.args=d.args,c.options.asHelper=d.asHelper,h=function(){return c.apply(this,j.call(arguments))},a[d.asHelper]=h):h=function(a,e){if(d.simple){var f={buffer:[],escape:b.prototype.escape,raw:b.prototype.raw};return c(a,f,e,vash)}e=i(a,e);return c(a,e&&e.context||new b(a),e,vash)},h.toString=function(){return c.toString()},h._toString=function(){return Function.prototype.toString.call(h)},h.toClientString=function(){return"vash.link( "+c.toString()+", "+JSON.stringify(c.options)+" )"};return h};var j=Array.prototype.slice;vash.lookup=function(a,b){var c=vash.helpers.tplcache[a];if(!c)throw new Error("Could not find template: "+a);return b?c(b):c},vash.install=function(a,b){var c=vash.helpers.tplcache;if(typeof b=="string"){if(!vash.compile)throw new Error("vash.install(path, [string]) is not available in the standalone runtime.");b=vash.compile(b)}else if(typeof a=="object"){b=a,Object.keys(b).forEach(function(a){c[a]=b[a]});return c}return c[a]=b},vash.uninstall=function(a){var b=vash.helpers.tplcache,c=!1;if(typeof a=="string")return delete b[a];Object.keys(b).forEach(function(d){b[d]===a&&(c=delete b[d])});return c}}(),function(){var a=vash.helpers;a.trim=function(a){return a.replace(/^\s*|\s*$/g,"")},a.config.highlighter=null,a.highlight=function(b,c){var d=this.buffer.mark();c();var e=this.buffer.fromMark(d);this.buffer.push("<pre><code>"),a.config.highlighter?this.buffer.push(a.config.highlighter(b,e.join("")).value):this.buffer.push(e),this.buffer.push("</code></pre>")}}(),function(){if(typeof window=="undefined")var a=require("fs"),b=require("path");var c=vash.helpers;c.config.browser=!1,vash.loadFile=function(d,e,f){e=vQuery.extend({},vash.config,e||{});var g=c.config.browser,h;!g&&e.settings&&e.settings.views&&(d=b.normalize(d),d.indexOf(b.normalize(e.settings.views))===-1&&(d=b.join(e.settings.views,d)),b.extname(d)||(d+="."+(e.settings["view engine"]||"vash")));try{h=e.cache||g?c.tplcache[d]||(c.tplcache[d]=vash.compile(a.readFileSync(d,"utf8"))):vash.compile(a.readFileSync(d,"utf8")),f&&f(null,h)}catch(i){f&&f(i,null)}},vash.renderFile=function(a,b,c){vash.loadFile(a,b,function(a,d){var e=b.onRenderEnd;c(a,!a&&d(b,function(a,b){b.finishLayout(),e&&e(a,b)}))})},c._ensureLayoutProps=function(){this.appends=this.appends||{},this.prepends=this.prepends||{},this.blocks=this.blocks||{},this.blockMarks=this.blockMarks||{}},c.finishLayout=function(){this._ensureLayoutProps();var a=this,b,c,d,e,f,g,h,i;for(b in this.blockMarks)c=this.blockMarks[b],e=this.prepends[b],d=this.blocks[b],f=this.appends[b],g=c.pop(),h=this.buffer.mark(),e&&e.forEach(function(b){a.buffer.pushConcat(b)}),block=d.pop(),block&&this.buffer.pushConcat(block),f&&f.forEach(function(b){a.buffer.pushConcat(b)}),i=this.buffer.fromMark(h).join(""),this.buffer.spliceMark(g,0,i);for(b in this.blockMarks)this.blockMarks[b].forEach(function(a){a.destroy()});delete this.blockMarks,delete this.prepends,delete this.blocks,delete this.appends;return this.toString()},c.extend=function(a,b){var c=this,d=this.buffer,e=this.model,f;this._ensureLayoutProps(),vash.loadFile(a,this.model,function(a,d){var e=c.buffer.mark();b(c.model);var f=c.buffer.fromMark(e);c.isExtending=!0,d(c.model,{context:c}),c.isExtending=!1}),this.model=e},c.include=function(a,b){var c=this,d=this.buffer,e=this.model;vash.loadFile(a,this.model,function(a,d){d(b||c.model,{context:c})}),this.model=e},c.block=function(a,b){this._ensureLayoutProps();var c=this,d=this.blockMarks[a]||(this.blockMarks[a]=[]),e=this.blocks[a]||(this.blocks[a]=[]),f,g;b&&(f=this.buffer.mark(),b(this.model),g=this.buffer.fromMark(f),g.length&&!this.isExtending&&e.push(g),g.length&&this.isExtending&&e.unshift(g)),d.push(this.buffer.mark("block-"+a))},c._handlePrependAppend=function(a,b,c){this._ensureLayoutProps();var d=this.buffer.mark(),e,f=this[a],g=f[b]||(f[b]=[]);c(this.model),e=this.buffer.fromMark(d),g.push(e)},c.append=function(a,b){this._handlePrependAppend("appends",a,b)},c.prepend=function(a,b){this._handlePrependAppend("prepends",a,b)}}()
*/void 0,function(){function i(a,b){typeof b=="function"&&(b={onRenderEnd:b}),a&&a.onRenderEnd&&(b=b||{},b.onRenderEnd||(b.onRenderEnd=a.onRenderEnd),delete a.onRenderEnd),b||(b={});return b}vash=typeof vash=="undefined"?{}:vash,vash.compile||(typeof define=="function"&&define.amd?define(function(){return vash}):typeof module=="object"&&module.exports?module.exports=vash:window.vash=vash);var a=vash.helpers,b=function(a){this.buffer=new f,this.model=a,this.options=null,this.vl=0,this.vc=0};vash.helpers=a=b.prototype={constructor:b,config:{},tplcache:{}},a.toString=a.toHtmlString=function(){return this.buffer._vo.join("")};var c=/[&<>"'`]/g,d=function(a){return e[a]},e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};a.raw=function(a){var b=function(){return a};a=a!=null?a:"";return{toHtmlString:b,toString:b}},a.escape=function(a){var b=function(){return a};a=a!=null?a:"";if(typeof a.toHtmlString!="function"){a=a.toString().replace(c,d);return{toHtmlString:b,toString:b}}return a};var f=function(){this._vo=[]};f.prototype.mark=function(a){var b=new g(this,a);b.markedIndex=this._vo.length,this._vo.push(b.uid);return b},f.prototype.fromMark=function(a){var b=a.findInBuffer();if(b>-1){a.destroy();return this._vo.splice(b,this._vo.length)}return[]},f.prototype.spliceMark=function(a,b,c){var d=a.findInBuffer();if(d>-1){a.destroy(),arguments[0]=d;return this._vo.splice.apply(this._vo,arguments)}return[]},f.prototype.empty=function(){return this._vo.splice(0,this._vo.length)},f.prototype.push=function(a){return this._vo.push(a)},f.prototype.pushConcat=function(a){var b;Array.isArray(a)?b=a:arguments.length>1?b=Array.prototype.slice.call(arguments):b=[a];for(var c=0;c<b.length;c++)this._vo.push(b[c]);return this.__vo},f.prototype.indexOf=function(a){for(var b=0;b<this._vo.length;b++)if(a.test&&this._vo[b]&&this._vo[b].search(a)>-1||this._vo[b]==a)return b;return-1},f.prototype.lastIndexOf=function(a){var b=this._vo.length;while(--b>=0)if(a.test&&this._vo[b]&&this._vo[b].search(a)>-1||this._vo[b]==a)return b;return-1},f.prototype.splice=function(){return this._vo.splice.apply(this._vo,arguments)},f.prototype.index=function(a){return this._vo[a]},f.prototype.flush=function(){return this.empty().join("")},f.prototype.toString=f.prototype.toHtmlString=function(){return this._vo.join("")};var g=vash.Mark=function(a,b){this.uid="[VASHMARK-"+~~(Math.random()*1e7)+(b?":"+b:"")+"]",this.markedIndex=0,this.buffer=a,this.destroyed=!1},h=g.re=/\[VASHMARK\-\d{1,8}(?::[\s\S]+?)?]/g;g.uidLike=function(a){return(a||"").search(h)>-1},g.prototype.destroy=function(){var a=this.findInBuffer();a>-1&&(this.buffer.splice(a,1),this.markedIndex=-1),this.destroyed=!0},g.prototype.findInBuffer=function(){if(this.destroyed)return-1;if(this.markedIndex&&this.buffer.index(this.markedIndex)===this.uid)return this.markedIndex;var a=this.uid.replace(/(\[|\])/g,"\\$1"),b=new RegExp(a);return this.markedIndex=this.buffer.indexOf(b)},a.constructor.reportError=function(a,b,c,d,e){e=e||"!LB!";var f=d.split(e),g=b===0&&c===0?f.length-1:3,h=Math.max(0,b-g),i=Math.min(f.length,b+g),j=f.slice(h,i).map(function(a,c,d){var e=c+h+1;return(e===b?" > ":" ")+(e<10?" ":"")+e+" | "+a}).join("\n");a.vashlineno=b,a.vashcharno=c,a.message="Problem while rendering template at line "+b+", character "+c+".\nOriginal message: "+a.message+"."+"\nContext: \n\n"+j+"\n\n";throw a},a.reportError=function(){this.constructor.reportError.apply(this,arguments)},vash.link=function(c,d){var e,f;d.args||(d.args=[d.modelName,d.helpersName,"__vopts","vash"]);if(typeof c=="string"){e=c;try{f=d.args.slice(),f.push(c),c=Function.apply(null,f)}catch(g){a.reportError(g,0,0,e,/\n/)}}c.options={simple:d.simple,modelName:d.modelName,helpersName:d.helpersName};var h;d.asHelper?(c.options.args=d.args,c.options.asHelper=d.asHelper,h=function(){return c.apply(this,j.call(arguments))},a[d.asHelper]=h):h=function(a,e){if(d.simple){var f={buffer:[],escape:b.prototype.escape,raw:b.prototype.raw};return c(a,f,e,vash)}e=i(a,e);return c(a,e&&e.context||new b(a),e,vash)},h.toString=function(){return c.toString()},h._toString=function(){return Function.prototype.toString.call(h)},h.toClientString=function(){return"vash.link( "+c.toString()+", "+JSON.stringify(c.options)+" )"};return h};var j=Array.prototype.slice;vash.lookup=function(a,b){var c=vash.helpers.tplcache[a];if(!c)throw new Error("Could not find template: "+a);return b?c(b):c},vash.install=function(a,b){var c=vash.helpers.tplcache;if(typeof b=="string"){if(!vash.compile)throw new Error("vash.install(path, [string]) is not available in the standalone runtime.");b=vash.compile(b)}else if(typeof a=="object"){b=a,Object.keys(b).forEach(function(a){c[a]=b[a]});return c}return c[a]=b},vash.uninstall=function(a){var b=vash.helpers.tplcache,c=!1;if(typeof a=="string")return delete b[a];Object.keys(b).forEach(function(d){b[d]===a&&(c=delete b[d])});return c}}(),function(){var a=vash.helpers;a.trim=function(a){return a.replace(/^\s*|\s*$/g,"")},a.config.highlighter=null,a.highlight=function(b,c){var d=this.buffer.mark();c();var e=this.buffer.fromMark(d);this.buffer.push("<pre><code>"),a.config.highlighter?this.buffer.push(a.config.highlighter(b,e.join("")).value):this.buffer.push(e),this.buffer.push("</code></pre>")}}(),function(){function d(a){var b=vash.Mark.re,c=[],d="";a.forEach(function(a){b.exec(a)?(c.push(d,a),d=""):d+=a||""}),c.push(d);return c}if(typeof window=="undefined")var a=require("fs"),b=require("path");var c=vash.helpers;c.config.browser=!1,vash.loadFile=function(d,e,f){e=vQuery.extend({},vash.config,e||{});var g=c.config.browser,h;!g&&e.settings&&e.settings.views&&(d=b.normalize(d),d.indexOf(b.normalize(e.settings.views))===-1&&(d=b.join(e.settings.views,d)),b.extname(d)||(d+="."+(e.settings["view engine"]||"vash")));try{h=e.cache||g?c.tplcache[d]||(c.tplcache[d]=vash.compile(a.readFileSync(d,"utf8"))):vash.compile(a.readFileSync(d,"utf8")),f&&f(null,h)}catch(i){f&&f(i,null)}},vash.renderFile=function(a,b,c){vash.loadFile(a,b,function(a,d){var e=b.onRenderEnd;c(a,!a&&d(b,function(a,b){b.finishLayout(),e&&e(a,b)}))})},c._ensureLayoutProps=function(){this.appends=this.appends||{},this.prepends=this.prepends||{},this.blocks=this.blocks||{},this.blockMarks=this.blockMarks||{}},c.finishLayout=function(){this._ensureLayoutProps();var a=this,b,c,e,f,g,h,i,j;for(b in this.blockMarks)c=this.blockMarks[b],f=this.prepends[b],e=this.blocks[b],g=this.appends[b],h=c.pop(),i=this.buffer.mark(),f&&f.forEach(function(b){a.buffer.pushConcat(b)}),block=e.pop(),block&&this.buffer.pushConcat(block),g&&g.forEach(function(b){a.buffer.pushConcat(b)}),j=this.buffer.fromMark(i),j=d(j),j.unshift(h,0),this.buffer.spliceMark.apply(this.buffer,j);for(b in this.blockMarks)this.blockMarks[b].forEach(function(a){a.destroy()});delete this.blockMarks,delete this.prepends,delete this.blocks,delete this.appends;return this.toString()},c.extend=function(a,b){var c=this,d=this.buffer,e=this.model,f;this._ensureLayoutProps(),vash.loadFile(a,this.model,function(a,d){var e=c.buffer.mark();b(c.model);var f=c.buffer.fromMark(e);c.isExtending=!0,d(c.model,{context:c}),c.isExtending=!1}),this.model=e},c.include=function(a,b){var c=this,d=this.buffer,e=this.model;vash.loadFile(a,this.model,function(a,d){d(b||c.model,{context:c})}),this.model=e},c.block=function(a,b){this._ensureLayoutProps();var c=this,d=this.blockMarks[a]||(this.blockMarks[a]=[]),e=this.blocks[a]||(this.blocks[a]=[]),f,g;b&&(f=this.buffer.mark(),b(this.model),g=this.buffer.fromMark(f),g.length&&!this.isExtending&&e.push(g),g.length&&this.isExtending&&e.unshift(g)),d.push(this.buffer.mark("block-"+a))},c._handlePrependAppend=function(a,b,c){this._ensureLayoutProps();var d=this.buffer.mark(),e,f=this[a],g=f[b]||(f[b]=[]);c(this.model),e=this.buffer.fromMark(d),g.push(e)},c.append=function(a,b){this._handlePrependAppend("appends",a,b)},c.prepend=function(a,b){this._handlePrependAppend("prepends",a,b)}}()
/**
* Vash - JavaScript Template Parser, v0.7.10-2
* Vash - JavaScript Template Parser, v0.7.11-3
*

@@ -167,3 +167,3 @@ * https://github.com/kirbysayshi/vash

if(
( str.test && this._vo[i].search(str) > -1 )
( str.test && this._vo[i] && this._vo[i].search(str) > -1 )
|| this._vo[i] == str

@@ -183,3 +183,3 @@ ){

if(
( str.test && this._vo[i].search(str) > -1 )
( str.test && this._vo[i] && this._vo[i].search(str) > -1 )
|| this._vo[i] == str

@@ -230,3 +230,3 @@ ){

var reMark = /\[VASHMARK\-\d{1,8}(?::[\s\S]+?)?]/g
var reMark = Mark.re = /\[VASHMARK\-\d{1,8}(?::[\s\S]+?)?]/g

@@ -260,3 +260,9 @@ // tests if a string has a mark-like uid within it

return this.markedIndex = this.buffer.indexOf( this.uid );
// The mark may be within a string due to string shenanigans. If this is
// true this is bad, because all the Mark manipulation commands assume
// that the Mark is the only content at that index in the buffer, which
// means that splice commands will result in lost content.
var escaped = this.uid.replace(/(\[|\])/g, '\\$1');
var re = new RegExp(escaped);
return this.markedIndex = this.buffer.indexOf( re );
}

@@ -263,0 +269,0 @@

/**
* Vash - JavaScript Template Parser, v0.7.10-2
* Vash - JavaScript Template Parser, v0.7.11-3
*

@@ -8,2 +8,2 @@ * https://github.com/kirbysayshi/vash

* MIT License (LICENSE)
*/void 0,function(){function i(a,b){typeof b=="function"&&(b={onRenderEnd:b}),a&&a.onRenderEnd&&(b=b||{},b.onRenderEnd||(b.onRenderEnd=a.onRenderEnd),delete a.onRenderEnd),b||(b={});return b}vash=typeof vash=="undefined"?{}:vash,vash.compile||(typeof define=="function"&&define.amd?define(function(){return vash}):typeof module=="object"&&module.exports?module.exports=vash:window.vash=vash);var a=vash.helpers,b=function(a){this.buffer=new f,this.model=a,this.options=null,this.vl=0,this.vc=0};vash.helpers=a=b.prototype={constructor:b,config:{},tplcache:{}},a.toString=a.toHtmlString=function(){return this.buffer._vo.join("")};var c=/[&<>"'`]/g,d=function(a){return e[a]},e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};a.raw=function(a){var b=function(){return a};a=a!=null?a:"";return{toHtmlString:b,toString:b}},a.escape=function(a){var b=function(){return a};a=a!=null?a:"";if(typeof a.toHtmlString!="function"){a=a.toString().replace(c,d);return{toHtmlString:b,toString:b}}return a};var f=function(){this._vo=[]};f.prototype.mark=function(a){var b=new g(this,a);b.markedIndex=this._vo.length,this._vo.push(b.uid);return b},f.prototype.fromMark=function(a){var b=a.findInBuffer();if(b>-1){a.destroy();return this._vo.splice(b,this._vo.length)}return[]},f.prototype.spliceMark=function(a,b,c){var d=a.findInBuffer();if(d>-1){a.destroy(),arguments[0]=d;return this._vo.splice.apply(this._vo,arguments)}return[]},f.prototype.empty=function(){return this._vo.splice(0,this._vo.length)},f.prototype.push=function(a){return this._vo.push(a)},f.prototype.pushConcat=function(a){var b;Array.isArray(a)?b=a:arguments.length>1?b=Array.prototype.slice.call(arguments):b=[a];for(var c=0;c<b.length;c++)this._vo.push(b[c]);return this.__vo},f.prototype.indexOf=function(a){for(var b=0;b<this._vo.length;b++)if(a.test&&this._vo[b].search(a)>-1||this._vo[b]==a)return b;return-1},f.prototype.lastIndexOf=function(a){var b=this._vo.length;while(--b>=0)if(a.test&&this._vo[b].search(a)>-1||this._vo[b]==a)return b;return-1},f.prototype.splice=function(){return this._vo.splice.apply(this._vo,arguments)},f.prototype.index=function(a){return this._vo[a]},f.prototype.flush=function(){return this.empty().join("")},f.prototype.toString=f.prototype.toHtmlString=function(){return this._vo.join("")};var g=vash.Mark=function(a,b){this.uid="[VASHMARK-"+~~(Math.random()*1e7)+(b?":"+b:"")+"]",this.markedIndex=0,this.buffer=a,this.destroyed=!1},h=/\[VASHMARK\-\d{1,8}(?::[\s\S]+?)?]/g;g.uidLike=function(a){return(a||"").search(h)>-1},g.prototype.destroy=function(){var a=this.findInBuffer();a>-1&&(this.buffer.splice(a,1),this.markedIndex=-1),this.destroyed=!0},g.prototype.findInBuffer=function(){return this.destroyed?-1:this.markedIndex&&this.buffer.index(this.markedIndex)===this.uid?this.markedIndex:this.markedIndex=this.buffer.indexOf(this.uid)},a.constructor.reportError=function(a,b,c,d,e){e=e||"!LB!";var f=d.split(e),g=b===0&&c===0?f.length-1:3,h=Math.max(0,b-g),i=Math.min(f.length,b+g),j=f.slice(h,i).map(function(a,c,d){var e=c+h+1;return(e===b?" > ":" ")+(e<10?" ":"")+e+" | "+a}).join("\n");a.vashlineno=b,a.vashcharno=c,a.message="Problem while rendering template at line "+b+", character "+c+".\nOriginal message: "+a.message+"."+"\nContext: \n\n"+j+"\n\n";throw a},a.reportError=function(){this.constructor.reportError.apply(this,arguments)},vash.link=function(c,d){var e,f;d.args||(d.args=[d.modelName,d.helpersName,"__vopts","vash"]);if(typeof c=="string"){e=c;try{f=d.args.slice(),f.push(c),c=Function.apply(null,f)}catch(g){a.reportError(g,0,0,e,/\n/)}}c.options={simple:d.simple,modelName:d.modelName,helpersName:d.helpersName};var h;d.asHelper?(c.options.args=d.args,c.options.asHelper=d.asHelper,h=function(){return c.apply(this,j.call(arguments))},a[d.asHelper]=h):h=function(a,e){if(d.simple){var f={buffer:[],escape:b.prototype.escape,raw:b.prototype.raw};return c(a,f,e,vash)}e=i(a,e);return c(a,e&&e.context||new b(a),e,vash)},h.toString=function(){return c.toString()},h._toString=function(){return Function.prototype.toString.call(h)},h.toClientString=function(){return"vash.link( "+c.toString()+", "+JSON.stringify(c.options)+" )"};return h};var j=Array.prototype.slice;vash.lookup=function(a,b){var c=vash.helpers.tplcache[a];if(!c)throw new Error("Could not find template: "+a);return b?c(b):c},vash.install=function(a,b){var c=vash.helpers.tplcache;if(typeof b=="string"){if(!vash.compile)throw new Error("vash.install(path, [string]) is not available in the standalone runtime.");b=vash.compile(b)}else if(typeof a=="object"){b=a,Object.keys(b).forEach(function(a){c[a]=b[a]});return c}return c[a]=b},vash.uninstall=function(a){var b=vash.helpers.tplcache,c=!1;if(typeof a=="string")return delete b[a];Object.keys(b).forEach(function(d){b[d]===a&&(c=delete b[d])});return c}}()
*/void 0,function(){function i(a,b){typeof b=="function"&&(b={onRenderEnd:b}),a&&a.onRenderEnd&&(b=b||{},b.onRenderEnd||(b.onRenderEnd=a.onRenderEnd),delete a.onRenderEnd),b||(b={});return b}vash=typeof vash=="undefined"?{}:vash,vash.compile||(typeof define=="function"&&define.amd?define(function(){return vash}):typeof module=="object"&&module.exports?module.exports=vash:window.vash=vash);var a=vash.helpers,b=function(a){this.buffer=new f,this.model=a,this.options=null,this.vl=0,this.vc=0};vash.helpers=a=b.prototype={constructor:b,config:{},tplcache:{}},a.toString=a.toHtmlString=function(){return this.buffer._vo.join("")};var c=/[&<>"'`]/g,d=function(a){return e[a]},e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};a.raw=function(a){var b=function(){return a};a=a!=null?a:"";return{toHtmlString:b,toString:b}},a.escape=function(a){var b=function(){return a};a=a!=null?a:"";if(typeof a.toHtmlString!="function"){a=a.toString().replace(c,d);return{toHtmlString:b,toString:b}}return a};var f=function(){this._vo=[]};f.prototype.mark=function(a){var b=new g(this,a);b.markedIndex=this._vo.length,this._vo.push(b.uid);return b},f.prototype.fromMark=function(a){var b=a.findInBuffer();if(b>-1){a.destroy();return this._vo.splice(b,this._vo.length)}return[]},f.prototype.spliceMark=function(a,b,c){var d=a.findInBuffer();if(d>-1){a.destroy(),arguments[0]=d;return this._vo.splice.apply(this._vo,arguments)}return[]},f.prototype.empty=function(){return this._vo.splice(0,this._vo.length)},f.prototype.push=function(a){return this._vo.push(a)},f.prototype.pushConcat=function(a){var b;Array.isArray(a)?b=a:arguments.length>1?b=Array.prototype.slice.call(arguments):b=[a];for(var c=0;c<b.length;c++)this._vo.push(b[c]);return this.__vo},f.prototype.indexOf=function(a){for(var b=0;b<this._vo.length;b++)if(a.test&&this._vo[b]&&this._vo[b].search(a)>-1||this._vo[b]==a)return b;return-1},f.prototype.lastIndexOf=function(a){var b=this._vo.length;while(--b>=0)if(a.test&&this._vo[b]&&this._vo[b].search(a)>-1||this._vo[b]==a)return b;return-1},f.prototype.splice=function(){return this._vo.splice.apply(this._vo,arguments)},f.prototype.index=function(a){return this._vo[a]},f.prototype.flush=function(){return this.empty().join("")},f.prototype.toString=f.prototype.toHtmlString=function(){return this._vo.join("")};var g=vash.Mark=function(a,b){this.uid="[VASHMARK-"+~~(Math.random()*1e7)+(b?":"+b:"")+"]",this.markedIndex=0,this.buffer=a,this.destroyed=!1},h=g.re=/\[VASHMARK\-\d{1,8}(?::[\s\S]+?)?]/g;g.uidLike=function(a){return(a||"").search(h)>-1},g.prototype.destroy=function(){var a=this.findInBuffer();a>-1&&(this.buffer.splice(a,1),this.markedIndex=-1),this.destroyed=!0},g.prototype.findInBuffer=function(){if(this.destroyed)return-1;if(this.markedIndex&&this.buffer.index(this.markedIndex)===this.uid)return this.markedIndex;var a=this.uid.replace(/(\[|\])/g,"\\$1"),b=new RegExp(a);return this.markedIndex=this.buffer.indexOf(b)},a.constructor.reportError=function(a,b,c,d,e){e=e||"!LB!";var f=d.split(e),g=b===0&&c===0?f.length-1:3,h=Math.max(0,b-g),i=Math.min(f.length,b+g),j=f.slice(h,i).map(function(a,c,d){var e=c+h+1;return(e===b?" > ":" ")+(e<10?" ":"")+e+" | "+a}).join("\n");a.vashlineno=b,a.vashcharno=c,a.message="Problem while rendering template at line "+b+", character "+c+".\nOriginal message: "+a.message+"."+"\nContext: \n\n"+j+"\n\n";throw a},a.reportError=function(){this.constructor.reportError.apply(this,arguments)},vash.link=function(c,d){var e,f;d.args||(d.args=[d.modelName,d.helpersName,"__vopts","vash"]);if(typeof c=="string"){e=c;try{f=d.args.slice(),f.push(c),c=Function.apply(null,f)}catch(g){a.reportError(g,0,0,e,/\n/)}}c.options={simple:d.simple,modelName:d.modelName,helpersName:d.helpersName};var h;d.asHelper?(c.options.args=d.args,c.options.asHelper=d.asHelper,h=function(){return c.apply(this,j.call(arguments))},a[d.asHelper]=h):h=function(a,e){if(d.simple){var f={buffer:[],escape:b.prototype.escape,raw:b.prototype.raw};return c(a,f,e,vash)}e=i(a,e);return c(a,e&&e.context||new b(a),e,vash)},h.toString=function(){return c.toString()},h._toString=function(){return Function.prototype.toString.call(h)},h.toClientString=function(){return"vash.link( "+c.toString()+", "+JSON.stringify(c.options)+" )"};return h};var j=Array.prototype.slice;vash.lookup=function(a,b){var c=vash.helpers.tplcache[a];if(!c)throw new Error("Could not find template: "+a);return b?c(b):c},vash.install=function(a,b){var c=vash.helpers.tplcache;if(typeof b=="string"){if(!vash.compile)throw new Error("vash.install(path, [string]) is not available in the standalone runtime.");b=vash.compile(b)}else if(typeof a=="object"){b=a,Object.keys(b).forEach(function(a){c[a]=b[a]});return c}return c[a]=b},vash.uninstall=function(a){var b=vash.helpers.tplcache,c=!1;if(typeof a=="string")return delete b[a];Object.keys(b).forEach(function(d){b[d]===a&&(c=delete b[d])});return c}}()
/**
* Vash - JavaScript Template Parser, v0.7.10-2
* Vash - JavaScript Template Parser, v0.7.11-3
*

@@ -1648,3 +1648,3 @@ * https://github.com/kirbysayshi/vash

if(
( str.test && this._vo[i].search(str) > -1 )
( str.test && this._vo[i] && this._vo[i].search(str) > -1 )
|| this._vo[i] == str

@@ -1664,3 +1664,3 @@ ){

if(
( str.test && this._vo[i].search(str) > -1 )
( str.test && this._vo[i] && this._vo[i].search(str) > -1 )
|| this._vo[i] == str

@@ -1711,3 +1711,3 @@ ){

var reMark = /\[VASHMARK\-\d{1,8}(?::[\s\S]+?)?]/g
var reMark = Mark.re = /\[VASHMARK\-\d{1,8}(?::[\s\S]+?)?]/g

@@ -1741,3 +1741,9 @@ // tests if a string has a mark-like uid within it

return this.markedIndex = this.buffer.indexOf( this.uid );
// The mark may be within a string due to string shenanigans. If this is
// true this is bad, because all the Mark manipulation commands assume
// that the Mark is the only content at that index in the buffer, which
// means that splice commands will result in lost content.
var escaped = this.uid.replace(/(\[|\])/g, '\\$1');
var re = new RegExp(escaped);
return this.markedIndex = this.buffer.indexOf( re );
}

@@ -2127,6 +2133,13 @@

// grab rendered content, immediately join to prevent needing to use
// .apply.
content = this.buffer.fromMark( m ).join('');
this.buffer.spliceMark( injectMark, 0, content );
// grab rendered content
content = this.buffer.fromMark( m )
// Join, but split out the VASHMARKS so further buffer operations are still
// sane. Join is required to prevent max argument errors when large templates
// are being used.
content = compactContent(content);
// Prep for apply, ensure the right location (mark) is used for injection.
content.unshift( injectMark, 0 );
this.buffer.spliceMark.apply( this.buffer, content );
}

@@ -2150,2 +2163,25 @@

// Given an array, condense all the strings to as few array elements
// as possible, while preserving `Mark`s as individual elements.
function compactContent(content) {
var re = vash.Mark.re;
var parts = [];
var str = '';
content.forEach(function(part) {
if (re.exec(part)) {
parts.push(str, part);
str = '';
} else {
// Ensure `undefined`s are not `toString`ed
str += (part || '');
}
});
// And don't forget the rest.
parts.push(str);
return parts;
}
helpers.extend = function(path, ctn){

@@ -2265,2 +2301,2 @@ var self = this

return exports;
}({ "version": "0.7.10-2" }));
}({ "version": "0.7.11-3" }));
/**
* Vash - JavaScript Template Parser, v0.7.10-2
* Vash - JavaScript Template Parser, v0.7.11-3
*

@@ -8,2 +8,2 @@ * https://github.com/kirbysayshi/vash

* MIT License (LICENSE)
*/void 0,function(a){typeof define=="function"&&define.amd?define(a):typeof module=="object"&&module.exports?module.exports=a:window.vash=a}(function(a){function R(a,b,c){this.ast=a,this.originalMarkup=b||"",this.options=c||{},this.reQuote=/(['"])/gi,this.reEscapedQuote=/\\+(["'])/gi,this.reLineBreak=/\r?\n/gi,this.reHelpersName=/HELPERSNAME/g,this.reModelName=/MODELNAME/g,this.reOriginalMarkup=/ORIGINALMARKUP/g,this.buffer=[]}function M(a,b){this.options=b||{},this.tokens=a,this.ast=L(N),this.prevTokens=[],this.inCommentLine=!1}function K(a){this.input=this.originalInput=a.replace(/^\uFEFF/,"").replace(/\r\n|\r/g,"\n"),this.lineno=1,this.charno=0}var b=a,c="AT",d="ASSIGN_OPERATOR",e="AT_COLON",f="AT_STAR_CLOSE",g="AT_STAR_OPEN",h="BACKSLASH",i="BRACE_CLOSE",j="BRACE_OPEN",k="CONTENT",l="DOUBLE_QUOTE",m="EMAIL",n="ESCAPED_QUOTE",o="FORWARD_SLASH",p="FUNCTION",q="HARD_PAREN_CLOSE",r="HARD_PAREN_OPEN",s="HTML_TAG_CLOSE",t="HTML_TAG_OPEN",u="HTML_TAG_VOID_CLOSE",v="IDENTIFIER",w="KEYWORD",x="LOGICAL",y="NEWLINE",z="NUMERIC_CONTENT",A="OPERATOR",B="PAREN_CLOSE",C="PAREN_OPEN",D="PERIOD",E="SINGLE_QUOTE",F="TEXT_TAG_CLOSE",G="TEXT_TAG_OPEN",H="WHITESPACE",I={};I[g]=f,I[j]=i,I[l]=l,I[r]=q,I[C]=B,I[E]=E,I[e]=y,I[o]=o;var J=[m,/^([a-zA-Z0-9.%]+@[a-zA-Z0-9.\-]+\.(?:ca|co\.uk|com|edu|net|org))\b/,g,/^(@\*)/,f,/^(\*@)/,e,/^(@\:)/,c,/^(@)/,C,/^(\()/,B,/^(\))/,r,/^(\[)/,q,/^(\])/,j,/^(\{)/,i,/^(\})/,G,/^(<text>)/,F,/^(<\/text>)/,t,function(){var a=/^(<[a-zA-Z@]+?[^>]*?["a-zA-Z]*>)/,b=/([a-zA-Z0-9.%]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,4})\b/,c=this.scan(a,t);c&&(this.spewIf(c,b),this.spewIf(c,/(@)/),this.spewIf(c,/(\/\s*>)/));return c},s,/^(<\/[^>@\b]+?>)/,u,/^(\/\s*>)/,D,/^(\.)/,y,function(){var a=this.scan(/^(\n)/,y);a&&(this.lineno++,this.charno=0);return a},H,/^(\s)/,p,/^(function)(?![\d\w])/,w,/^(case|catch|do|else|finally|for|function|goto|if|instanceof|return|switch|try|typeof|var|while|with)(?![\d\w])/,v,/^([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)/,o,/^(\/)/,A,/^(===|!==|==|!==|>>>|<<|>>|>=|<=|>|<|\+|-|\/|\*|\^|%|\:|\?)/,d,/^(\|=|\^=|&=|>>>=|>>=|<<=|-=|\+=|%=|\/=|\*=|=)/,x,/^(&&|\|\||&|\||\^)/,n,/^(\\+['"])/,h,/^(\\)/,l,/^(\")/,E,/^(\')/,z,/^([0-9]+)/,k,/^([^\s})@.]+?)/];K.prototype={scan:function(a,b){var c,d;if(c=a.exec(this.input)){this.input=this.input.substr(c[1].length),d={type:b,line:this.lineno,chr:this.charno,val:c[1]||"",toString:function(){return"["+this.type+" ("+this.line+","+this.chr+"): "+this.val+"]"}},this.charno+=c[0].length;return d}},spewIf:function(a,b){var c,d,e;a&&(c=b.exec(a.val),c&&(d=a.val.indexOf(c[1]),e=a.val.substring(d),this.input=e+this.input,this.charno-=e.length,a.val=a.val.substring(0,d)));return a},advance:function(){var a,b,c,d;for(a=0;a<J.length;a+=2){c=J[a+1],c.displayName=J[a],typeof c=="function"&&(d=c.call(this)),typeof c.exec=="function"&&(d=this.scan(c,J[a]));if(d)return d}}};var L=function(a){return new L.fn.init(a)};L.prototype.init=function(a){typeof a=="string"&&(this.mode=a),this.maxCheck()},L.fn=L.prototype.init.prototype=L.prototype,L.fn.vquery="yep",L.fn.constructor=L,L.fn.length=0,L.fn.parent=null,L.fn.mode=null,L.fn.tagName=null,L.fn.beget=function(a,b){var c=L(a);c.parent=this,this.push(c),b&&(c.tagName=b),this.maxCheck();return c},L.fn.closest=function(a,b){var c=this;while(c)if(c.tagName!==b&&c.parent)c=c.parent;else break;return c},L.fn.pushFlatten=function(a){var b=a,c,d;while(b.length===1&&b[0].vquery)b=b[0];if(b.mode!==N)this.push(b);else for(c=0;c<b.length;c++)this.push(b[c]);this.maxCheck();return this},L.fn.push=function(a){L.isArray(a)?(a.vquery&&a.forEach(function(a){a.parent=this},this),Array.prototype.push.apply(this,a)):(a.vquery&&(a.parent=this),Array.prototype.push.call(this,a)),this.maxCheck();return this.length},L.fn.root=function(){var a=this;while(a&&a.parent&&(a=a.parent));return a},L.fn.toTreeString=function(){function c(d){var e,f;a.push(Array(b).join(" |")+" +"+d.mode+" "+(d.tagName||"")),b+=1,e=d.slice();while(f=e.shift())f.vquery===L.fn.vquery?c(f):a.push(Array(b).join(" |")+" "+(f?f.toString().replace(/(\r|\n)/g,""):"[empty]"));b-=1,a.push(Array(b).join(" |")+" -"+d.mode+" "+(d.tagName||""))}var a=[],b=1;c(this);return a.join("\n")},L.fn.maxCheck=function(a){if(this.length>=L.maxSize){var b=new Error;b.message="Maximum number of elements exceeded.\nThis is typically caused by an unmatched character or tag. Parse tree follows:\n"+this.toTreeString(),b.name="vQueryDepthException";throw b}},L.maxSize=1e5,L.fn.flatten=function(){var a;return this.reduce(function b(c,d,e,f){if(d.vquery){c.push({type:"META",val:"START"+d.mode,tagName:d.tagName}),a=d.reduce(b,c),a.push({type:"META",val:"END"+d.mode,tagName:d.tagName});return a}d.mode=f.mode,c.push(d);return c},[])},L.reconstitute=function(a){return a.reduce(function b(a,b,c,d){b.type==="META"?a=a.parent:(b.mode!==a.mode&&(a=a.beget(b.mode,b.tagName)),a.push(b));return a},L(N))},L.isArray=function(a){return Object.prototype.toString.call(a)=="[object Array]"},L.extend=function(a){var b,c,d;for(c=1;c<arguments.length;c++){b=arguments[c];for(d in b)a[d]=b[d]}return a},L.takeMethodsFromArray=function(){var a=["pop","push","reverse","shift","sort","splice","unshift","concat","join","slice","indexOf","lastIndexOf","filter","forEach","every","map","some","reduce","reduceRight"],b=[],c;for(var d=0;d<a.length;d++){c=a[d];if(typeof b[c]=="function")L.fn[c]||function(a){L.fn[a]=function(){return b[a].apply(this,Array.prototype.slice.call(arguments,0))}}(c);else throw new Error("Vash requires ES5 array iteration methods, missing: "+c)}},L.takeMethodsFromArray();var N="PROGRAM",O="MARKUP",P="BLOCK",Q="EXPRESSION";M.prototype={parse:function(){var a,b,c,d;while(this.prevTokens.push(a),a=this.tokens.pop()){this.options.debugParser&&console.log(this.ast&&this.ast.mode,a.type,a.toString(),a.val);if(this.ast.mode===N||this.ast.mode===null)this.ast=this.ast.beget(this.options.initialMode||O),this.options.initialMode===Q&&(this.ast=this.ast.beget(Q));if(this.ast.mode===O){this.handleMKP(a);continue}if(this.ast.mode===P){this.handleBLK(a);continue}if(this.ast.mode===Q){this.handleEXP(a);continue}}this.ast=this.ast.root(),this.options.debugParser&&!this.options.initialMode&&(console.log(this.ast.toString()),console.log(this.ast.toTreeString()));return this.ast},exceptionFactory:function(a,b,c){b=="UNMATCHED"&&(a.name="UnmatchedCharacterError",this.ast=this.ast.root(),c&&(a.message="Unmatched "+c.type+" at line "+c.line+", character "+c.chr+". Value: "+c.val+"\n "+this.ast.toTreeString(),a.lineNumber=c.line));return a},advanceUntilNot:function(a){var b,c,d=[];while(c=this.tokens[this.tokens.length-1])if(c.type===a)b=this.tokens.pop(),d.push(b);else break;return d},advanceUntilMatched:function(a,b,c,d,e){var f=a,g=null,h=0,i=0,j=[];while(f){f.type===b?g&&g.type!==d&&b!==c||!g?h++:b===c&&g.type!==d&&i++:f.type===c&&(i++,g&&g.type===e&&i--),j.push(f);if(h===i)break;g=f,f=this.tokens.pop();if(!f)throw this.exceptionFactory(new Error,"UNMATCHED",a)}return j.reverse()},subParse:function(a,b,d){var e,f,g,h=L.extend({},this.options);h.initialMode=b,e=this.advanceUntilMatched(a,a.type,I[a.type],null,c),e.pop(),f=e.shift(),d||this.ast.push(a),g=new M(e,h),g.parse(),d&&(g.ast[0].unshift(a),g.ast[0].push(f)),this.ast.pushFlatten(g.ast),d||this.ast.push(f)},handleMKP:function(a){var b=this.tokens[this.tokens.length-1],d=this.tokens[this.tokens.length-2],i=null,k;switch(a.type){case g:this.advanceUntilMatched(a,g,f,c,c);break;case c:if(b){this.options.saveAT&&this.ast.push(a);switch(b.type){case C:case v:this.ast.length===0&&(this.ast=this.ast.parent,this.ast.pop()),this.ast=this.ast.beget(Q);break;case w:case p:case j:this.ast.length===0&&(this.ast=this.ast.parent,this.ast.pop()),this.ast=this.ast.beget(P);break;case c:case e:b.type="CONTENT",this.ast.push(this.tokens.pop());break;default:this.ast.push(this.tokens.pop())}}break;case G:case t:i=a.val.match(/^<([^\/ >]+)/i),i===null&&b&&b.type===c&&d&&(i=d.val.match(/(.*)/)),this.ast.tagName?this.ast=this.ast.beget(O,i[1]):this.ast.tagName=i[1],(t===a.type||this.options.saveTextTag)&&this.ast.push(a);break;case F:case s:i=a.val.match(/^<\/([^>]+)/i),i===null&&b&&b.type===c&&d&&(i=d.val.match(/(.*)/)),k=this.ast.closest(O,i[1]),k!==null&&k.tagName===i[1]&&(this.ast=k),(s===a.type||this.options.saveTextTag)&&this.ast.push(a),this.ast.parent&&this.ast.parent.mode===P&&(this.ast=this.ast.parent);break;case u:this.ast.push(a),this.ast=this.ast.parent;break;case h:a.val+="\\",this.ast.push(a);break;default:this.ast.push(a)}},handleBLK:function(a){var b=this.tokens[this.tokens.length-1],d,i,m,n,q,r,u;switch(a.type){case c:b.type!==c&&!this.inCommentLine?(this.tokens.push(a),this.ast=this.ast.beget(O)):(b.type=k,this.ast.push(b),this.tokens.pop());break;case g:this.advanceUntilMatched(a,g,f,c,c);break;case e:this.subParse(a,O,!0);break;case G:case F:case t:case s:this.ast=this.ast.beget(O),this.tokens.push(a);break;case o:case E:case l:a.type===o&&b&&b.type===o&&(this.inCommentLine=!0),this.inCommentLine?this.ast.push(a):(n=this.advanceUntilMatched(a,a.type,I[a.type],h,h).map(function(a){a.type===c&&(a.type=k);return a}),this.ast.pushFlatten(n.reverse()));break;case y:this.inCommentLine&&(this.inCommentLine=!1),this.ast.push(a);break;case j:case C:d=this.options.favorText&&a.type===j?O:P,this.subParse(a,d),n=this.advanceUntilNot(H),b=this.tokens[this.tokens.length-1],b&&b.type!==w&&b.type!==p&&b.type!==j&&a.type!==C?(this.tokens.push.apply(this.tokens,n.reverse()),this.ast=this.ast.parent):this.ast.push(n);break;default:this.ast.push(a)}},handleEXP:function(a){var b=null,e,f,g,i,k,m,n;switch(a.type){case w:case p:this.ast=this.ast.beget(P),this.tokens.push(a);break;case H:case x:case d:case A:case z:this.ast.parent&&this.ast.parent.mode===Q?this.ast.push(a):(this.ast=this.ast.parent,this.tokens.push(a));break;case v:this.ast.push(a);break;case E:case l:this.ast.parent&&this.ast.parent.mode===Q?(k=this.advanceUntilMatched(a,a.type,I[a.type],h,h),this.ast.pushFlatten(k.reverse())):(this.ast=this.ast.parent,this.tokens.push(a));break;case r:case C:m=this.prevTokens[this.prevTokens.length-1],b=this.tokens[this.tokens.length-1];if(a.type===r&&b.type===q){this.tokens.push(a),this.ast=this.ast.parent;break}this.subParse(a,Q),b=this.tokens[this.tokens.length-1];if(m&&m.type===c||b&&b.type===v)this.ast=this.ast.parent;break;case j:this.tokens.push(a),this.ast=this.ast.beget(P);break;case D:b=this.tokens[this.tokens.length-1],b&&(b.type===v||b.type===w||b.type===p||b.type===D||this.ast.parent&&this.ast.parent.mode===Q)?this.ast.push(a):(this.ast=this.ast.parent,this.tokens.push(a));break;default:this.ast.parent&&this.ast.parent.mode!==Q?(this.ast=this.ast.parent,this.tokens.push(a)):this.ast.push(a)}}};var S=R.prototype;S.insertDebugVars=function(a){this.options.debug&&this.buffer.push(this.options.helpersName+".vl = "+a.line+", ",this.options.helpersName+".vc = "+a.chr+"; \n")},S.visitMarkupTok=function(a,b,c){this.insertDebugVars(a),this.buffer.push("MKP("+a.val.replace(this.reEscapedQuote,"\\\\$1").replace(this.reQuote,"\\$1").replace(this.reLineBreak,"\\n")+")MKP")},S.visitBlockTok=function(a,b,c){this.buffer.push(a.val)},S.visitExpressionTok=function(a,b,c,d){var e="",f="",g=b.parent&&b.parent.mode!==Q;this.options.htmlEscape!==!1&&(g&&c===0&&d&&(e+=this.options.helpersName+".escape("),g&&c===b.length-1&&d&&(f+=").toHtmlString()")),g&&c===0&&(this.insertDebugVars(a),e="__vbuffer.push("+e),g&&c===b.length-1&&(f+="); \n"),this.buffer.push(e+a.val+f),g&&c===b.length-1&&this.insertDebugVars(a)},S.visitNode=function(a){var b,d=a.slice(0),f,g,h;a.mode===Q&&a.parent&&a.parent.mode!==Q&&(f=a.filter(R.findNonExp).length);for(g=0;g<d.length;g++){h=d[g];if(h.type&&h.type===c||h.type===e)continue;h.vquery?this.visitNode(h):a.mode===O?this.visitMarkupTok(h,a,g):a.mode===P?this.visitBlockTok(h,a,g):a.mode===Q&&this.visitExpressionTok(h,a,g,f>0?!1:!0)}},S.escapeForDebug=function(a){return a.replace(this.reLineBreak,"!LB!").replace(this.reQuote,"\\$1").replace(this.reEscapedQuote,"\\$1")},S.replaceDevTokens=function(a){return a.replace(this.reHelpersName,this.options.helpersName).replace(this.reModelName,this.options.modelName)},S.addHead=function(a){var b=this.options,c=""+(b.debug?"try { \n":"")+"var __vbuffer = HELPERSNAME.buffer; \n"+"HELPERSNAME.options = __vopts; \n"+"MODELNAME = MODELNAME || {}; \n"+(b.useWith?"with( MODELNAME ){ \n":"");c=this.replaceDevTokens(c);return c+a},S.addHelperHead=function(a){var b=this.options,c=""+(b.debug?"try { \n":"")+"var __vbuffer = this.buffer; \n"+"var MODELNAME = this.model; \n"+"var HELPERSNAME = this; \n";c=this.replaceDevTokens(c);return c+a},S.addFoot=function(a){var b=this.options,c=""+(b.simple?'return HELPERSNAME.buffer.join(""); \n':"(__vopts && __vopts.onRenderEnd && __vopts.onRenderEnd(null, HELPERSNAME)); \nreturn (__vopts && __vopts.asContext) \n ? HELPERSNAME \n : HELPERSNAME.toString(); \n")+(b.useWith?"} \n":"")+(b.debug?'} catch( e ){ \n HELPERSNAME.reportError( e, HELPERSNAME.vl, HELPERSNAME.vc, "ORIGINALMARKUP" ); \n} \n':"");c=this.replaceDevTokens(c).replace(this.reOriginalMarkup,this.escapeForDebug(this.originalMarkup));return a+c},S.addHelperFoot=function(a){var b=this.options,c=""+(b.debug?'} catch( e ){ \n HELPERSNAME.reportError( e, HELPERSNAME.vl, HELPERSNAME.vc, "ORIGINALMARKUP" ); \n} \n':"");c=this.replaceDevTokens(c).replace(this.reOriginalMarkup,this.escapeForDebug(this.originalMarkup));return a+c},S.generate=function(){var a=this.options;this.buffer.length=0,this.visitNode(this.ast);var c=this.buffer.join("").split(")MKPMKP(").join("").split("MKP(").join("__vbuffer.push('").split(")MKP").join("'); \n");a.asHelper?(c=this.addHelperHead(c),c=this.addHelperFoot(c)):(c=this.addHead(c),c=this.addFoot(c)),a.debugCompiler&&(console.log(c),console.log(a)),this.cmpFunc=b.link(c,a);return this.cmpFunc},R.noop=function(){},R.findNonExp=function(a){return a.vquery&&a.mode===Q?a.filter(R.findNonExp).length>0:a.vquery&&a.mode!==Q?!0:!1},a.config={useWith:!1,modelName:"model",helpersName:"html",htmlEscape:!0,debug:!0,debugParser:!1,debugCompiler:!1,simple:!1,favorText:!1,externs:["window","document"],saveTextTag:!1,saveAT:!1},a.compile=function(b,c){if(b===""||typeof b!="string")throw new Error("Empty or non-string cannot be compiled");var d,e,f=[],g,h,i,j;c=L.extend({},a.config,c||{}),d=new K(b);while(e=d.advance())f.push(e);f.reverse(),g=new M(f,c),g.parse(),h=new R(g.ast,b,c),i=h.generate();return i};var T=Array.prototype.slice,U=/vash\.helpers\.([^= ]+?)\s*=\s*function([^(]*?)\(([^)]*?)\)\s*{/,V=/\}$/,W=/^\/\/\s*@\s*batch\s*=\s*(.*?)$/,X=function(a,b,c,d){var e=b.split(/[\n\r]/g),f={},g=[],h="";e.forEach(function(b,e){var g=a.exec(b),i=g?c.apply(g,g):null;i&&(h=i,f[h]=[]),(!i||d)&&b&&f[h].push(b)}),Object.keys(f).forEach(function(a){f[a]=f[a].join("\n")});return f},Y=function(a,c,d){var e=a==="helper"?U:W,f=X(e,c,function(a,b){return b.replace(/^\s+|\s+$/,"")},a==="helper"?!0:!1);f&&(Object.keys(f).forEach(function(c){f[c]=a==="helper"?Z(f[c],d):b.compile("@{"+f[c]+"}",d)}),f.toClientString=function(){return Object.keys(f).reduce(function(a,b){return b==="toClientString"?a:a+f[b].toClientString()+"\n"},"")});return f},Z=function(a,c){c=c||{};var d=a.replace(/^[\s\n\r]+|[\s\n\r]+$/,"").match(U),e=d[3].split(",").map(function(a){return a.replace(" ","")}),f=d[1],g=a.replace(U,"").replace(V,"");g="@{"+g+"}",c.args=e,c.asHelper=f;return b.compile(g,c)};a.compileHelper=Y.bind(null,"helper"),a.compileBatch=a.batch=Y.bind(null,"batch"),a.VLexer=K,a.VParser=M,a.VCompiler=R,a.vQuery=L,function(){function j(a,b){typeof b=="function"&&(b={onRenderEnd:b}),a&&a.onRenderEnd&&(b=b||{},b.onRenderEnd||(b.onRenderEnd=a.onRenderEnd),delete a.onRenderEnd),b||(b={});return b}b=typeof b=="undefined"?{}:b,b.compile||(typeof define=="function"&&define.amd?define(function(){return b}):typeof module=="object"&&module.exports?module.exports=b:window.vash=b);var a=b.helpers,c=function(a){this.buffer=new g,this.model=a,this.options=null,this.vl=0,this.vc=0};b.helpers=a=c.prototype={constructor:c,config:{},tplcache:{}},a.toString=a.toHtmlString=function(){return this.buffer._vo.join("")};var d=/[&<>"'`]/g,e=function(a){return f[a]},f={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};a.raw=function(a){var b=function(){return a};a=a!=null?a:"";return{toHtmlString:b,toString:b}},a.escape=function(a){var b=function(){return a};a=a!=null?a:"";if(typeof a.toHtmlString!="function"){a=a.toString().replace(d,e);return{toHtmlString:b,toString:b}}return a};var g=function(){this._vo=[]};g.prototype.mark=function(a){var b=new h(this,a);b.markedIndex=this._vo.length,this._vo.push(b.uid);return b},g.prototype.fromMark=function(a){var b=a.findInBuffer();if(b>-1){a.destroy();return this._vo.splice(b,this._vo.length)}return[]},g.prototype.spliceMark=function(a,b,c){var d=a.findInBuffer();if(d>-1){a.destroy(),arguments[0]=d;return this._vo.splice.apply(this._vo,arguments)}return[]},g.prototype.empty=function(){return this._vo.splice(0,this._vo.length)},g.prototype.push=function(a){return this._vo.push(a)},g.prototype.pushConcat=function(a){var b;Array.isArray(a)?b=a:arguments.length>1?b=Array.prototype.slice.call(arguments):b=[a];for(var c=0;c<b.length;c++)this._vo.push(b[c]);return this.__vo},g.prototype.indexOf=function(a){for(var b=0;b<this._vo.length;b++)if(a.test&&this._vo[b].search(a)>-1||this._vo[b]==a)return b;return-1},g.prototype.lastIndexOf=function(a){var b=this._vo.length;while(--b>=0)if(a.test&&this._vo[b].search(a)>-1||this._vo[b]==a)return b;return-1},g.prototype.splice=function(){return this._vo.splice.apply(this._vo,arguments)},g.prototype.index=function(a){return this._vo[a]},g.prototype.flush=function(){return this.empty().join("")},g.prototype.toString=g.prototype.toHtmlString=function(){return this._vo.join("")};var h=b.Mark=function(a,b){this.uid="[VASHMARK-"+~~(Math.random()*1e7)+(b?":"+b:"")+"]",this.markedIndex=0,this.buffer=a,this.destroyed=!1},i=/\[VASHMARK\-\d{1,8}(?::[\s\S]+?)?]/g;h.uidLike=function(a){return(a||"").search(i)>-1},h.prototype.destroy=function(){var a=this.findInBuffer();a>-1&&(this.buffer.splice(a,1),this.markedIndex=-1),this.destroyed=!0},h.prototype.findInBuffer=function(){return this.destroyed?-1:this.markedIndex&&this.buffer.index(this.markedIndex)===this.uid?this.markedIndex:this.markedIndex=this.buffer.indexOf(this.uid)},a.constructor.reportError=function(a,b,c,d,e){e=e||"!LB!";var f=d.split(e),g=b===0&&c===0?f.length-1:3,h=Math.max(0,b-g),i=Math.min(f.length,b+g),j=f.slice(h,i).map(function(a,c,d){var e=c+h+1;return(e===b?" > ":" ")+(e<10?" ":"")+e+" | "+a}).join("\n");a.vashlineno=b,a.vashcharno=c,a.message="Problem while rendering template at line "+b+", character "+c+".\nOriginal message: "+a.message+"."+"\nContext: \n\n"+j+"\n\n";throw a},a.reportError=function(){this.constructor.reportError.apply(this,arguments)},b.link=function(d,e){var f,g;e.args||(e.args=[e.modelName,e.helpersName,"__vopts","vash"]);if(typeof d=="string"){f=d;try{g=e.args.slice(),g.push(d),d=Function.apply(null,g)}catch(h){a.reportError(h,0,0,f,/\n/)}}d.options={simple:e.simple,modelName:e.modelName,helpersName:e.helpersName};var i;e.asHelper?(d.options.args=e.args,d.options.asHelper=e.asHelper,i=function(){return d.apply(this,k.call(arguments))},a[e.asHelper]=i):i=function(a,f){if(e.simple){var g={buffer:[],escape:c.prototype.escape,raw:c.prototype.raw};return d(a,g,f,b)}f=j(a,f);return d(a,f&&f.context||new c(a),f,b)},i.toString=function(){return d.toString()},i._toString=function(){return Function.prototype.toString.call(i)},i.toClientString=function(){return"vash.link( "+d.toString()+", "+JSON.stringify(d.options)+" )"};return i};var k=Array.prototype.slice;b.lookup=function(a,c){var d=b.helpers.tplcache[a];if(!d)throw new Error("Could not find template: "+a);return c?d(c):d},b.install=function(a,c){var d=b.helpers.tplcache;if(typeof c=="string"){if(!b.compile)throw new Error("vash.install(path, [string]) is not available in the standalone runtime.");c=b.compile(c)}else if(typeof a=="object"){c=a,Object.keys(c).forEach(function(a){d[a]=c[a]});return d}return d[a]=c},b.uninstall=function(a){var c=b.helpers.tplcache,d=!1;if(typeof a=="string")return delete c[a];Object.keys(c).forEach(function(b){c[b]===a&&(d=delete c[b])});return d}}(),function(){var a=b.helpers;a.trim=function(a){return a.replace(/^\s*|\s*$/g,"")},a.config.highlighter=null,a.highlight=function(b,c){var d=this.buffer.mark();c();var e=this.buffer.fromMark(d);this.buffer.push("<pre><code>"),a.config.highlighter?this.buffer.push(a.config.highlighter(b,e.join("")).value):this.buffer.push(e),this.buffer.push("</code></pre>")}}(),function(){if(typeof window=="undefined")var a=require("fs"),c=require("path");var d=b.helpers;d.config.browser=!1,b.loadFile=function(e,f,g){f=L.extend({},b.config,f||{});var h=d.config.browser,i;!h&&f.settings&&f.settings.views&&(e=c.normalize(e),e.indexOf(c.normalize(f.settings.views))===-1&&(e=c.join(f.settings.views,e)),c.extname(e)||(e+="."+(f.settings["view engine"]||"vash")));try{i=f.cache||h?d.tplcache[e]||(d.tplcache[e]=b.compile(a.readFileSync(e,"utf8"))):b.compile(a.readFileSync(e,"utf8")),g&&g(null,i)}catch(j){g&&g(j,null)}},b.renderFile=function(a,c,d){b.loadFile(a,c,function(a,b){var e=c.onRenderEnd;d(a,!a&&b(c,function(a,b){b.finishLayout(),e&&e(a,b)}))})},d._ensureLayoutProps=function(){this.appends=this.appends||{},this.prepends=this.prepends||{},this.blocks=this.blocks||{},this.blockMarks=this.blockMarks||{}},d.finishLayout=function(){this._ensureLayoutProps();var a=this,b,c,d,e,f,g,h,i;for(b in this.blockMarks)c=this.blockMarks[b],e=this.prepends[b],d=this.blocks[b],f=this.appends[b],g=c.pop(),h=this.buffer.mark(),e&&e.forEach(function(b){a.buffer.pushConcat(b)}),block=d.pop(),block&&this.buffer.pushConcat(block),f&&f.forEach(function(b){a.buffer.pushConcat(b)}),i=this.buffer.fromMark(h).join(""),this.buffer.spliceMark(g,0,i);for(b in this.blockMarks)this.blockMarks[b].forEach(function(a){a.destroy()});delete this.blockMarks,delete this.prepends,delete this.blocks,delete this.appends;return this.toString()},d.extend=function(a,c){var d=this,e=this.buffer,f=this.model,g;this._ensureLayoutProps(),b.loadFile(a,this.model,function(a,b){var e=d.buffer.mark();c(d.model);var f=d.buffer.fromMark(e);d.isExtending=!0,b(d.model,{context:d}),d.isExtending=!1}),this.model=f},d.include=function(a,c){var d=this,e=this.buffer,f=this.model;b.loadFile(a,this.model,function(a,b){b(c||d.model,{context:d})}),this.model=f},d.block=function(a,b){this._ensureLayoutProps();var c=this,d=this.blockMarks[a]||(this.blockMarks[a]=[]),e=this.blocks[a]||(this.blocks[a]=[]),f,g;b&&(f=this.buffer.mark(),b(this.model),g=this.buffer.fromMark(f),g.length&&!this.isExtending&&e.push(g),g.length&&this.isExtending&&e.unshift(g)),d.push(this.buffer.mark("block-"+a))},d._handlePrependAppend=function(a,b,c){this._ensureLayoutProps();var d=this.buffer.mark(),e,f=this[a],g=f[b]||(f[b]=[]);c(this.model),e=this.buffer.fromMark(d),g.push(e)},d.append=function(a,b){this._handlePrependAppend("appends",a,b)},d.prepend=function(a,b){this._handlePrependAppend("prepends",a,b)}}(),a.__express=a.renderFile;return a}({version:"0.7.10-2"}))
*/void 0,function(a){typeof define=="function"&&define.amd?define(a):typeof module=="object"&&module.exports?module.exports=a:window.vash=a}(function(a){function R(a,b,c){this.ast=a,this.originalMarkup=b||"",this.options=c||{},this.reQuote=/(['"])/gi,this.reEscapedQuote=/\\+(["'])/gi,this.reLineBreak=/\r?\n/gi,this.reHelpersName=/HELPERSNAME/g,this.reModelName=/MODELNAME/g,this.reOriginalMarkup=/ORIGINALMARKUP/g,this.buffer=[]}function M(a,b){this.options=b||{},this.tokens=a,this.ast=L(N),this.prevTokens=[],this.inCommentLine=!1}function K(a){this.input=this.originalInput=a.replace(/^\uFEFF/,"").replace(/\r\n|\r/g,"\n"),this.lineno=1,this.charno=0}var b=a,c="AT",d="ASSIGN_OPERATOR",e="AT_COLON",f="AT_STAR_CLOSE",g="AT_STAR_OPEN",h="BACKSLASH",i="BRACE_CLOSE",j="BRACE_OPEN",k="CONTENT",l="DOUBLE_QUOTE",m="EMAIL",n="ESCAPED_QUOTE",o="FORWARD_SLASH",p="FUNCTION",q="HARD_PAREN_CLOSE",r="HARD_PAREN_OPEN",s="HTML_TAG_CLOSE",t="HTML_TAG_OPEN",u="HTML_TAG_VOID_CLOSE",v="IDENTIFIER",w="KEYWORD",x="LOGICAL",y="NEWLINE",z="NUMERIC_CONTENT",A="OPERATOR",B="PAREN_CLOSE",C="PAREN_OPEN",D="PERIOD",E="SINGLE_QUOTE",F="TEXT_TAG_CLOSE",G="TEXT_TAG_OPEN",H="WHITESPACE",I={};I[g]=f,I[j]=i,I[l]=l,I[r]=q,I[C]=B,I[E]=E,I[e]=y,I[o]=o;var J=[m,/^([a-zA-Z0-9.%]+@[a-zA-Z0-9.\-]+\.(?:ca|co\.uk|com|edu|net|org))\b/,g,/^(@\*)/,f,/^(\*@)/,e,/^(@\:)/,c,/^(@)/,C,/^(\()/,B,/^(\))/,r,/^(\[)/,q,/^(\])/,j,/^(\{)/,i,/^(\})/,G,/^(<text>)/,F,/^(<\/text>)/,t,function(){var a=/^(<[a-zA-Z@]+?[^>]*?["a-zA-Z]*>)/,b=/([a-zA-Z0-9.%]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,4})\b/,c=this.scan(a,t);c&&(this.spewIf(c,b),this.spewIf(c,/(@)/),this.spewIf(c,/(\/\s*>)/));return c},s,/^(<\/[^>@\b]+?>)/,u,/^(\/\s*>)/,D,/^(\.)/,y,function(){var a=this.scan(/^(\n)/,y);a&&(this.lineno++,this.charno=0);return a},H,/^(\s)/,p,/^(function)(?![\d\w])/,w,/^(case|catch|do|else|finally|for|function|goto|if|instanceof|return|switch|try|typeof|var|while|with)(?![\d\w])/,v,/^([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)/,o,/^(\/)/,A,/^(===|!==|==|!==|>>>|<<|>>|>=|<=|>|<|\+|-|\/|\*|\^|%|\:|\?)/,d,/^(\|=|\^=|&=|>>>=|>>=|<<=|-=|\+=|%=|\/=|\*=|=)/,x,/^(&&|\|\||&|\||\^)/,n,/^(\\+['"])/,h,/^(\\)/,l,/^(\")/,E,/^(\')/,z,/^([0-9]+)/,k,/^([^\s})@.]+?)/];K.prototype={scan:function(a,b){var c,d;if(c=a.exec(this.input)){this.input=this.input.substr(c[1].length),d={type:b,line:this.lineno,chr:this.charno,val:c[1]||"",toString:function(){return"["+this.type+" ("+this.line+","+this.chr+"): "+this.val+"]"}},this.charno+=c[0].length;return d}},spewIf:function(a,b){var c,d,e;a&&(c=b.exec(a.val),c&&(d=a.val.indexOf(c[1]),e=a.val.substring(d),this.input=e+this.input,this.charno-=e.length,a.val=a.val.substring(0,d)));return a},advance:function(){var a,b,c,d;for(a=0;a<J.length;a+=2){c=J[a+1],c.displayName=J[a],typeof c=="function"&&(d=c.call(this)),typeof c.exec=="function"&&(d=this.scan(c,J[a]));if(d)return d}}};var L=function(a){return new L.fn.init(a)};L.prototype.init=function(a){typeof a=="string"&&(this.mode=a),this.maxCheck()},L.fn=L.prototype.init.prototype=L.prototype,L.fn.vquery="yep",L.fn.constructor=L,L.fn.length=0,L.fn.parent=null,L.fn.mode=null,L.fn.tagName=null,L.fn.beget=function(a,b){var c=L(a);c.parent=this,this.push(c),b&&(c.tagName=b),this.maxCheck();return c},L.fn.closest=function(a,b){var c=this;while(c)if(c.tagName!==b&&c.parent)c=c.parent;else break;return c},L.fn.pushFlatten=function(a){var b=a,c,d;while(b.length===1&&b[0].vquery)b=b[0];if(b.mode!==N)this.push(b);else for(c=0;c<b.length;c++)this.push(b[c]);this.maxCheck();return this},L.fn.push=function(a){L.isArray(a)?(a.vquery&&a.forEach(function(a){a.parent=this},this),Array.prototype.push.apply(this,a)):(a.vquery&&(a.parent=this),Array.prototype.push.call(this,a)),this.maxCheck();return this.length},L.fn.root=function(){var a=this;while(a&&a.parent&&(a=a.parent));return a},L.fn.toTreeString=function(){function c(d){var e,f;a.push(Array(b).join(" |")+" +"+d.mode+" "+(d.tagName||"")),b+=1,e=d.slice();while(f=e.shift())f.vquery===L.fn.vquery?c(f):a.push(Array(b).join(" |")+" "+(f?f.toString().replace(/(\r|\n)/g,""):"[empty]"));b-=1,a.push(Array(b).join(" |")+" -"+d.mode+" "+(d.tagName||""))}var a=[],b=1;c(this);return a.join("\n")},L.fn.maxCheck=function(a){if(this.length>=L.maxSize){var b=new Error;b.message="Maximum number of elements exceeded.\nThis is typically caused by an unmatched character or tag. Parse tree follows:\n"+this.toTreeString(),b.name="vQueryDepthException";throw b}},L.maxSize=1e5,L.fn.flatten=function(){var a;return this.reduce(function b(c,d,e,f){if(d.vquery){c.push({type:"META",val:"START"+d.mode,tagName:d.tagName}),a=d.reduce(b,c),a.push({type:"META",val:"END"+d.mode,tagName:d.tagName});return a}d.mode=f.mode,c.push(d);return c},[])},L.reconstitute=function(a){return a.reduce(function b(a,b,c,d){b.type==="META"?a=a.parent:(b.mode!==a.mode&&(a=a.beget(b.mode,b.tagName)),a.push(b));return a},L(N))},L.isArray=function(a){return Object.prototype.toString.call(a)=="[object Array]"},L.extend=function(a){var b,c,d;for(c=1;c<arguments.length;c++){b=arguments[c];for(d in b)a[d]=b[d]}return a},L.takeMethodsFromArray=function(){var a=["pop","push","reverse","shift","sort","splice","unshift","concat","join","slice","indexOf","lastIndexOf","filter","forEach","every","map","some","reduce","reduceRight"],b=[],c;for(var d=0;d<a.length;d++){c=a[d];if(typeof b[c]=="function")L.fn[c]||function(a){L.fn[a]=function(){return b[a].apply(this,Array.prototype.slice.call(arguments,0))}}(c);else throw new Error("Vash requires ES5 array iteration methods, missing: "+c)}},L.takeMethodsFromArray();var N="PROGRAM",O="MARKUP",P="BLOCK",Q="EXPRESSION";M.prototype={parse:function(){var a,b,c,d;while(this.prevTokens.push(a),a=this.tokens.pop()){this.options.debugParser&&console.log(this.ast&&this.ast.mode,a.type,a.toString(),a.val);if(this.ast.mode===N||this.ast.mode===null)this.ast=this.ast.beget(this.options.initialMode||O),this.options.initialMode===Q&&(this.ast=this.ast.beget(Q));if(this.ast.mode===O){this.handleMKP(a);continue}if(this.ast.mode===P){this.handleBLK(a);continue}if(this.ast.mode===Q){this.handleEXP(a);continue}}this.ast=this.ast.root(),this.options.debugParser&&!this.options.initialMode&&(console.log(this.ast.toString()),console.log(this.ast.toTreeString()));return this.ast},exceptionFactory:function(a,b,c){b=="UNMATCHED"&&(a.name="UnmatchedCharacterError",this.ast=this.ast.root(),c&&(a.message="Unmatched "+c.type+" at line "+c.line+", character "+c.chr+". Value: "+c.val+"\n "+this.ast.toTreeString(),a.lineNumber=c.line));return a},advanceUntilNot:function(a){var b,c,d=[];while(c=this.tokens[this.tokens.length-1])if(c.type===a)b=this.tokens.pop(),d.push(b);else break;return d},advanceUntilMatched:function(a,b,c,d,e){var f=a,g=null,h=0,i=0,j=[];while(f){f.type===b?g&&g.type!==d&&b!==c||!g?h++:b===c&&g.type!==d&&i++:f.type===c&&(i++,g&&g.type===e&&i--),j.push(f);if(h===i)break;g=f,f=this.tokens.pop();if(!f)throw this.exceptionFactory(new Error,"UNMATCHED",a)}return j.reverse()},subParse:function(a,b,d){var e,f,g,h=L.extend({},this.options);h.initialMode=b,e=this.advanceUntilMatched(a,a.type,I[a.type],null,c),e.pop(),f=e.shift(),d||this.ast.push(a),g=new M(e,h),g.parse(),d&&(g.ast[0].unshift(a),g.ast[0].push(f)),this.ast.pushFlatten(g.ast),d||this.ast.push(f)},handleMKP:function(a){var b=this.tokens[this.tokens.length-1],d=this.tokens[this.tokens.length-2],i=null,k;switch(a.type){case g:this.advanceUntilMatched(a,g,f,c,c);break;case c:if(b){this.options.saveAT&&this.ast.push(a);switch(b.type){case C:case v:this.ast.length===0&&(this.ast=this.ast.parent,this.ast.pop()),this.ast=this.ast.beget(Q);break;case w:case p:case j:this.ast.length===0&&(this.ast=this.ast.parent,this.ast.pop()),this.ast=this.ast.beget(P);break;case c:case e:b.type="CONTENT",this.ast.push(this.tokens.pop());break;default:this.ast.push(this.tokens.pop())}}break;case G:case t:i=a.val.match(/^<([^\/ >]+)/i),i===null&&b&&b.type===c&&d&&(i=d.val.match(/(.*)/)),this.ast.tagName?this.ast=this.ast.beget(O,i[1]):this.ast.tagName=i[1],(t===a.type||this.options.saveTextTag)&&this.ast.push(a);break;case F:case s:i=a.val.match(/^<\/([^>]+)/i),i===null&&b&&b.type===c&&d&&(i=d.val.match(/(.*)/)),k=this.ast.closest(O,i[1]),k!==null&&k.tagName===i[1]&&(this.ast=k),(s===a.type||this.options.saveTextTag)&&this.ast.push(a),this.ast.parent&&this.ast.parent.mode===P&&(this.ast=this.ast.parent);break;case u:this.ast.push(a),this.ast=this.ast.parent;break;case h:a.val+="\\",this.ast.push(a);break;default:this.ast.push(a)}},handleBLK:function(a){var b=this.tokens[this.tokens.length-1],d,i,m,n,q,r,u;switch(a.type){case c:b.type!==c&&!this.inCommentLine?(this.tokens.push(a),this.ast=this.ast.beget(O)):(b.type=k,this.ast.push(b),this.tokens.pop());break;case g:this.advanceUntilMatched(a,g,f,c,c);break;case e:this.subParse(a,O,!0);break;case G:case F:case t:case s:this.ast=this.ast.beget(O),this.tokens.push(a);break;case o:case E:case l:a.type===o&&b&&b.type===o&&(this.inCommentLine=!0),this.inCommentLine?this.ast.push(a):(n=this.advanceUntilMatched(a,a.type,I[a.type],h,h).map(function(a){a.type===c&&(a.type=k);return a}),this.ast.pushFlatten(n.reverse()));break;case y:this.inCommentLine&&(this.inCommentLine=!1),this.ast.push(a);break;case j:case C:d=this.options.favorText&&a.type===j?O:P,this.subParse(a,d),n=this.advanceUntilNot(H),b=this.tokens[this.tokens.length-1],b&&b.type!==w&&b.type!==p&&b.type!==j&&a.type!==C?(this.tokens.push.apply(this.tokens,n.reverse()),this.ast=this.ast.parent):this.ast.push(n);break;default:this.ast.push(a)}},handleEXP:function(a){var b=null,e,f,g,i,k,m,n;switch(a.type){case w:case p:this.ast=this.ast.beget(P),this.tokens.push(a);break;case H:case x:case d:case A:case z:this.ast.parent&&this.ast.parent.mode===Q?this.ast.push(a):(this.ast=this.ast.parent,this.tokens.push(a));break;case v:this.ast.push(a);break;case E:case l:this.ast.parent&&this.ast.parent.mode===Q?(k=this.advanceUntilMatched(a,a.type,I[a.type],h,h),this.ast.pushFlatten(k.reverse())):(this.ast=this.ast.parent,this.tokens.push(a));break;case r:case C:m=this.prevTokens[this.prevTokens.length-1],b=this.tokens[this.tokens.length-1];if(a.type===r&&b.type===q){this.tokens.push(a),this.ast=this.ast.parent;break}this.subParse(a,Q),b=this.tokens[this.tokens.length-1];if(m&&m.type===c||b&&b.type===v)this.ast=this.ast.parent;break;case j:this.tokens.push(a),this.ast=this.ast.beget(P);break;case D:b=this.tokens[this.tokens.length-1],b&&(b.type===v||b.type===w||b.type===p||b.type===D||this.ast.parent&&this.ast.parent.mode===Q)?this.ast.push(a):(this.ast=this.ast.parent,this.tokens.push(a));break;default:this.ast.parent&&this.ast.parent.mode!==Q?(this.ast=this.ast.parent,this.tokens.push(a)):this.ast.push(a)}}};var S=R.prototype;S.insertDebugVars=function(a){this.options.debug&&this.buffer.push(this.options.helpersName+".vl = "+a.line+", ",this.options.helpersName+".vc = "+a.chr+"; \n")},S.visitMarkupTok=function(a,b,c){this.insertDebugVars(a),this.buffer.push("MKP("+a.val.replace(this.reEscapedQuote,"\\\\$1").replace(this.reQuote,"\\$1").replace(this.reLineBreak,"\\n")+")MKP")},S.visitBlockTok=function(a,b,c){this.buffer.push(a.val)},S.visitExpressionTok=function(a,b,c,d){var e="",f="",g=b.parent&&b.parent.mode!==Q;this.options.htmlEscape!==!1&&(g&&c===0&&d&&(e+=this.options.helpersName+".escape("),g&&c===b.length-1&&d&&(f+=").toHtmlString()")),g&&c===0&&(this.insertDebugVars(a),e="__vbuffer.push("+e),g&&c===b.length-1&&(f+="); \n"),this.buffer.push(e+a.val+f),g&&c===b.length-1&&this.insertDebugVars(a)},S.visitNode=function(a){var b,d=a.slice(0),f,g,h;a.mode===Q&&a.parent&&a.parent.mode!==Q&&(f=a.filter(R.findNonExp).length);for(g=0;g<d.length;g++){h=d[g];if(h.type&&h.type===c||h.type===e)continue;h.vquery?this.visitNode(h):a.mode===O?this.visitMarkupTok(h,a,g):a.mode===P?this.visitBlockTok(h,a,g):a.mode===Q&&this.visitExpressionTok(h,a,g,f>0?!1:!0)}},S.escapeForDebug=function(a){return a.replace(this.reLineBreak,"!LB!").replace(this.reQuote,"\\$1").replace(this.reEscapedQuote,"\\$1")},S.replaceDevTokens=function(a){return a.replace(this.reHelpersName,this.options.helpersName).replace(this.reModelName,this.options.modelName)},S.addHead=function(a){var b=this.options,c=""+(b.debug?"try { \n":"")+"var __vbuffer = HELPERSNAME.buffer; \n"+"HELPERSNAME.options = __vopts; \n"+"MODELNAME = MODELNAME || {}; \n"+(b.useWith?"with( MODELNAME ){ \n":"");c=this.replaceDevTokens(c);return c+a},S.addHelperHead=function(a){var b=this.options,c=""+(b.debug?"try { \n":"")+"var __vbuffer = this.buffer; \n"+"var MODELNAME = this.model; \n"+"var HELPERSNAME = this; \n";c=this.replaceDevTokens(c);return c+a},S.addFoot=function(a){var b=this.options,c=""+(b.simple?'return HELPERSNAME.buffer.join(""); \n':"(__vopts && __vopts.onRenderEnd && __vopts.onRenderEnd(null, HELPERSNAME)); \nreturn (__vopts && __vopts.asContext) \n ? HELPERSNAME \n : HELPERSNAME.toString(); \n")+(b.useWith?"} \n":"")+(b.debug?'} catch( e ){ \n HELPERSNAME.reportError( e, HELPERSNAME.vl, HELPERSNAME.vc, "ORIGINALMARKUP" ); \n} \n':"");c=this.replaceDevTokens(c).replace(this.reOriginalMarkup,this.escapeForDebug(this.originalMarkup));return a+c},S.addHelperFoot=function(a){var b=this.options,c=""+(b.debug?'} catch( e ){ \n HELPERSNAME.reportError( e, HELPERSNAME.vl, HELPERSNAME.vc, "ORIGINALMARKUP" ); \n} \n':"");c=this.replaceDevTokens(c).replace(this.reOriginalMarkup,this.escapeForDebug(this.originalMarkup));return a+c},S.generate=function(){var a=this.options;this.buffer.length=0,this.visitNode(this.ast);var c=this.buffer.join("").split(")MKPMKP(").join("").split("MKP(").join("__vbuffer.push('").split(")MKP").join("'); \n");a.asHelper?(c=this.addHelperHead(c),c=this.addHelperFoot(c)):(c=this.addHead(c),c=this.addFoot(c)),a.debugCompiler&&(console.log(c),console.log(a)),this.cmpFunc=b.link(c,a);return this.cmpFunc},R.noop=function(){},R.findNonExp=function(a){return a.vquery&&a.mode===Q?a.filter(R.findNonExp).length>0:a.vquery&&a.mode!==Q?!0:!1},a.config={useWith:!1,modelName:"model",helpersName:"html",htmlEscape:!0,debug:!0,debugParser:!1,debugCompiler:!1,simple:!1,favorText:!1,externs:["window","document"],saveTextTag:!1,saveAT:!1},a.compile=function(b,c){if(b===""||typeof b!="string")throw new Error("Empty or non-string cannot be compiled");var d,e,f=[],g,h,i,j;c=L.extend({},a.config,c||{}),d=new K(b);while(e=d.advance())f.push(e);f.reverse(),g=new M(f,c),g.parse(),h=new R(g.ast,b,c),i=h.generate();return i};var T=Array.prototype.slice,U=/vash\.helpers\.([^= ]+?)\s*=\s*function([^(]*?)\(([^)]*?)\)\s*{/,V=/\}$/,W=/^\/\/\s*@\s*batch\s*=\s*(.*?)$/,X=function(a,b,c,d){var e=b.split(/[\n\r]/g),f={},g=[],h="";e.forEach(function(b,e){var g=a.exec(b),i=g?c.apply(g,g):null;i&&(h=i,f[h]=[]),(!i||d)&&b&&f[h].push(b)}),Object.keys(f).forEach(function(a){f[a]=f[a].join("\n")});return f},Y=function(a,c,d){var e=a==="helper"?U:W,f=X(e,c,function(a,b){return b.replace(/^\s+|\s+$/,"")},a==="helper"?!0:!1);f&&(Object.keys(f).forEach(function(c){f[c]=a==="helper"?Z(f[c],d):b.compile("@{"+f[c]+"}",d)}),f.toClientString=function(){return Object.keys(f).reduce(function(a,b){return b==="toClientString"?a:a+f[b].toClientString()+"\n"},"")});return f},Z=function(a,c){c=c||{};var d=a.replace(/^[\s\n\r]+|[\s\n\r]+$/,"").match(U),e=d[3].split(",").map(function(a){return a.replace(" ","")}),f=d[1],g=a.replace(U,"").replace(V,"");g="@{"+g+"}",c.args=e,c.asHelper=f;return b.compile(g,c)};a.compileHelper=Y.bind(null,"helper"),a.compileBatch=a.batch=Y.bind(null,"batch"),a.VLexer=K,a.VParser=M,a.VCompiler=R,a.vQuery=L,function(){function j(a,b){typeof b=="function"&&(b={onRenderEnd:b}),a&&a.onRenderEnd&&(b=b||{},b.onRenderEnd||(b.onRenderEnd=a.onRenderEnd),delete a.onRenderEnd),b||(b={});return b}b=typeof b=="undefined"?{}:b,b.compile||(typeof define=="function"&&define.amd?define(function(){return b}):typeof module=="object"&&module.exports?module.exports=b:window.vash=b);var a=b.helpers,c=function(a){this.buffer=new g,this.model=a,this.options=null,this.vl=0,this.vc=0};b.helpers=a=c.prototype={constructor:c,config:{},tplcache:{}},a.toString=a.toHtmlString=function(){return this.buffer._vo.join("")};var d=/[&<>"'`]/g,e=function(a){return f[a]},f={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};a.raw=function(a){var b=function(){return a};a=a!=null?a:"";return{toHtmlString:b,toString:b}},a.escape=function(a){var b=function(){return a};a=a!=null?a:"";if(typeof a.toHtmlString!="function"){a=a.toString().replace(d,e);return{toHtmlString:b,toString:b}}return a};var g=function(){this._vo=[]};g.prototype.mark=function(a){var b=new h(this,a);b.markedIndex=this._vo.length,this._vo.push(b.uid);return b},g.prototype.fromMark=function(a){var b=a.findInBuffer();if(b>-1){a.destroy();return this._vo.splice(b,this._vo.length)}return[]},g.prototype.spliceMark=function(a,b,c){var d=a.findInBuffer();if(d>-1){a.destroy(),arguments[0]=d;return this._vo.splice.apply(this._vo,arguments)}return[]},g.prototype.empty=function(){return this._vo.splice(0,this._vo.length)},g.prototype.push=function(a){return this._vo.push(a)},g.prototype.pushConcat=function(a){var b;Array.isArray(a)?b=a:arguments.length>1?b=Array.prototype.slice.call(arguments):b=[a];for(var c=0;c<b.length;c++)this._vo.push(b[c]);return this.__vo},g.prototype.indexOf=function(a){for(var b=0;b<this._vo.length;b++)if(a.test&&this._vo[b]&&this._vo[b].search(a)>-1||this._vo[b]==a)return b;return-1},g.prototype.lastIndexOf=function(a){var b=this._vo.length;while(--b>=0)if(a.test&&this._vo[b]&&this._vo[b].search(a)>-1||this._vo[b]==a)return b;return-1},g.prototype.splice=function(){return this._vo.splice.apply(this._vo,arguments)},g.prototype.index=function(a){return this._vo[a]},g.prototype.flush=function(){return this.empty().join("")},g.prototype.toString=g.prototype.toHtmlString=function(){return this._vo.join("")};var h=b.Mark=function(a,b){this.uid="[VASHMARK-"+~~(Math.random()*1e7)+(b?":"+b:"")+"]",this.markedIndex=0,this.buffer=a,this.destroyed=!1},i=h.re=/\[VASHMARK\-\d{1,8}(?::[\s\S]+?)?]/g;h.uidLike=function(a){return(a||"").search(i)>-1},h.prototype.destroy=function(){var a=this.findInBuffer();a>-1&&(this.buffer.splice(a,1),this.markedIndex=-1),this.destroyed=!0},h.prototype.findInBuffer=function(){if(this.destroyed)return-1;if(this.markedIndex&&this.buffer.index(this.markedIndex)===this.uid)return this.markedIndex;var a=this.uid.replace(/(\[|\])/g,"\\$1"),b=new RegExp(a);return this.markedIndex=this.buffer.indexOf(b)},a.constructor.reportError=function(a,b,c,d,e){e=e||"!LB!";var f=d.split(e),g=b===0&&c===0?f.length-1:3,h=Math.max(0,b-g),i=Math.min(f.length,b+g),j=f.slice(h,i).map(function(a,c,d){var e=c+h+1;return(e===b?" > ":" ")+(e<10?" ":"")+e+" | "+a}).join("\n");a.vashlineno=b,a.vashcharno=c,a.message="Problem while rendering template at line "+b+", character "+c+".\nOriginal message: "+a.message+"."+"\nContext: \n\n"+j+"\n\n";throw a},a.reportError=function(){this.constructor.reportError.apply(this,arguments)},b.link=function(d,e){var f,g;e.args||(e.args=[e.modelName,e.helpersName,"__vopts","vash"]);if(typeof d=="string"){f=d;try{g=e.args.slice(),g.push(d),d=Function.apply(null,g)}catch(h){a.reportError(h,0,0,f,/\n/)}}d.options={simple:e.simple,modelName:e.modelName,helpersName:e.helpersName};var i;e.asHelper?(d.options.args=e.args,d.options.asHelper=e.asHelper,i=function(){return d.apply(this,k.call(arguments))},a[e.asHelper]=i):i=function(a,f){if(e.simple){var g={buffer:[],escape:c.prototype.escape,raw:c.prototype.raw};return d(a,g,f,b)}f=j(a,f);return d(a,f&&f.context||new c(a),f,b)},i.toString=function(){return d.toString()},i._toString=function(){return Function.prototype.toString.call(i)},i.toClientString=function(){return"vash.link( "+d.toString()+", "+JSON.stringify(d.options)+" )"};return i};var k=Array.prototype.slice;b.lookup=function(a,c){var d=b.helpers.tplcache[a];if(!d)throw new Error("Could not find template: "+a);return c?d(c):d},b.install=function(a,c){var d=b.helpers.tplcache;if(typeof c=="string"){if(!b.compile)throw new Error("vash.install(path, [string]) is not available in the standalone runtime.");c=b.compile(c)}else if(typeof a=="object"){c=a,Object.keys(c).forEach(function(a){d[a]=c[a]});return d}return d[a]=c},b.uninstall=function(a){var c=b.helpers.tplcache,d=!1;if(typeof a=="string")return delete c[a];Object.keys(c).forEach(function(b){c[b]===a&&(d=delete c[b])});return d}}(),function(){var a=b.helpers;a.trim=function(a){return a.replace(/^\s*|\s*$/g,"")},a.config.highlighter=null,a.highlight=function(b,c){var d=this.buffer.mark();c();var e=this.buffer.fromMark(d);this.buffer.push("<pre><code>"),a.config.highlighter?this.buffer.push(a.config.highlighter(b,e.join("")).value):this.buffer.push(e),this.buffer.push("</code></pre>")}}(),function(){function e(a){var c=b.Mark.re,d=[],e="";a.forEach(function(a){c.exec(a)?(d.push(e,a),e=""):e+=a||""}),d.push(e);return d}if(typeof window=="undefined")var a=require("fs"),c=require("path");var d=b.helpers;d.config.browser=!1,b.loadFile=function(e,f,g){f=L.extend({},b.config,f||{});var h=d.config.browser,i;!h&&f.settings&&f.settings.views&&(e=c.normalize(e),e.indexOf(c.normalize(f.settings.views))===-1&&(e=c.join(f.settings.views,e)),c.extname(e)||(e+="."+(f.settings["view engine"]||"vash")));try{i=f.cache||h?d.tplcache[e]||(d.tplcache[e]=b.compile(a.readFileSync(e,"utf8"))):b.compile(a.readFileSync(e,"utf8")),g&&g(null,i)}catch(j){g&&g(j,null)}},b.renderFile=function(a,c,d){b.loadFile(a,c,function(a,b){var e=c.onRenderEnd;d(a,!a&&b(c,function(a,b){b.finishLayout(),e&&e(a,b)}))})},d._ensureLayoutProps=function(){this.appends=this.appends||{},this.prepends=this.prepends||{},this.blocks=this.blocks||{},this.blockMarks=this.blockMarks||{}},d.finishLayout=function(){this._ensureLayoutProps();var a=this,b,c,d,f,g,h,i,j;for(b in this.blockMarks)c=this.blockMarks[b],f=this.prepends[b],d=this.blocks[b],g=this.appends[b],h=c.pop(),i=this.buffer.mark(),f&&f.forEach(function(b){a.buffer.pushConcat(b)}),block=d.pop(),block&&this.buffer.pushConcat(block),g&&g.forEach(function(b){a.buffer.pushConcat(b)}),j=this.buffer.fromMark(i),j=e(j),j.unshift(h,0),this.buffer.spliceMark.apply(this.buffer,j);for(b in this.blockMarks)this.blockMarks[b].forEach(function(a){a.destroy()});delete this.blockMarks,delete this.prepends,delete this.blocks,delete this.appends;return this.toString()},d.extend=function(a,c){var d=this,e=this.buffer,f=this.model,g;this._ensureLayoutProps(),b.loadFile(a,this.model,function(a,b){var e=d.buffer.mark();c(d.model);var f=d.buffer.fromMark(e);d.isExtending=!0,b(d.model,{context:d}),d.isExtending=!1}),this.model=f},d.include=function(a,c){var d=this,e=this.buffer,f=this.model;b.loadFile(a,this.model,function(a,b){b(c||d.model,{context:d})}),this.model=f},d.block=function(a,b){this._ensureLayoutProps();var c=this,d=this.blockMarks[a]||(this.blockMarks[a]=[]),e=this.blocks[a]||(this.blocks[a]=[]),f,g;b&&(f=this.buffer.mark(),b(this.model),g=this.buffer.fromMark(f),g.length&&!this.isExtending&&e.push(g),g.length&&this.isExtending&&e.unshift(g)),d.push(this.buffer.mark("block-"+a))},d._handlePrependAppend=function(a,b,c){this._ensureLayoutProps();var d=this.buffer.mark(),e,f=this[a],g=f[b]||(f[b]=[]);c(this.model),e=this.buffer.fromMark(d),g.push(e)},d.append=function(a,b){this._handlePrependAppend("appends",a,b)},d.prepend=function(a,b){this._handlePrependAppend("prepends",a,b)}}(),a.__express=a.renderFile;return a}({version:"0.7.11-3"}))
{
"name": "vash",
"description": "Razor syntax for JS templating",
"version": "0.7.10-2",
"version": "0.7.11-3",
"author": "Andrew Petersen <senofpeter@gmail.com>",

@@ -6,0 +6,0 @@ "homepage": "https://github.com/kirbysayshi/vash",

@@ -126,6 +126,13 @@ ;(function(){

// grab rendered content, immediately join to prevent needing to use
// .apply.
content = this.buffer.fromMark( m ).join('');
this.buffer.spliceMark( injectMark, 0, content );
// grab rendered content
content = this.buffer.fromMark( m )
// Join, but split out the VASHMARKS so further buffer operations are still
// sane. Join is required to prevent max argument errors when large templates
// are being used.
content = compactContent(content);
// Prep for apply, ensure the right location (mark) is used for injection.
content.unshift( injectMark, 0 );
this.buffer.spliceMark.apply( this.buffer, content );
}

@@ -149,2 +156,25 @@

// Given an array, condense all the strings to as few array elements
// as possible, while preserving `Mark`s as individual elements.
function compactContent(content) {
var re = vash.Mark.re;
var parts = [];
var str = '';
content.forEach(function(part) {
if (re.exec(part)) {
parts.push(str, part);
str = '';
} else {
// Ensure `undefined`s are not `toString`ed
str += (part || '');
}
});
// And don't forget the rest.
parts.push(str);
return parts;
}
helpers.extend = function(path, ctn){

@@ -151,0 +181,0 @@ var self = this

@@ -158,3 +158,3 @@ /*jshint strict:false, asi: false, laxcomma:true, laxbreak:true, boss:true, curly:true, node:true, browser:true, devel:true */

if(
( str.test && this._vo[i].search(str) > -1 )
( str.test && this._vo[i] && this._vo[i].search(str) > -1 )
|| this._vo[i] == str

@@ -174,3 +174,3 @@ ){

if(
( str.test && this._vo[i].search(str) > -1 )
( str.test && this._vo[i] && this._vo[i].search(str) > -1 )
|| this._vo[i] == str

@@ -221,3 +221,3 @@ ){

var reMark = /\[VASHMARK\-\d{1,8}(?::[\s\S]+?)?]/g
var reMark = Mark.re = /\[VASHMARK\-\d{1,8}(?::[\s\S]+?)?]/g

@@ -251,3 +251,9 @@ // tests if a string has a mark-like uid within it

return this.markedIndex = this.buffer.indexOf( this.uid );
// The mark may be within a string due to string shenanigans. If this is
// true this is bad, because all the Mark manipulation commands assume
// that the Mark is the only content at that index in the buffer, which
// means that splice commands will result in lost content.
var escaped = this.uid.replace(/(\[|\])/g, '\\$1');
var re = new RegExp(escaped);
return this.markedIndex = this.buffer.indexOf( re );
}

@@ -254,0 +260,0 @@

@@ -351,2 +351,53 @@ var vows = require('vows')

}
,'extended include': function( opts ){
// Scenario:
// A -> index <- included <- B
//
// A B
// | |
// v |
// index v
// included
var layout = '@html.block(\'bob\')';
var index = ''
+ '@html.extend(\'layout\', function(model) {'
+ '@html.block(\'bob\', function(model) {'
+ '<h1>Hello from [index.bob]</h1>'
+ '@html.include(\'templateToInclude\', model)'
+ '<p></p>'
+ '})'
+ '})'
var include = ''
+ '@html.extend(\'extendableTemplate\', function(model) {'
+ '@html.block(\'mary\', function(model) {'
+ '<h1>Hello from [templateToInclude.mary]</h1>'
+ '})'
+ '})'
var extendable = ''
+ '<h1>Hello from [extendableTemplate]</h1>'
+ '@html.block(\'mary\')'
var a = this.installTplAt('layout.vash', layout);
var b = this.installTplAt('templateToInclude.vash', include);
var c = this.installTplAt('extendableTemplate.vash', extendable);
var opts = this.opts( { cache: true, debug: true })
var tpl = vash.compile(index, opts);
var actual = tpl(opts);
var expected = ''
+ '<h1>Hello from [index.bob]</h1>'
+ '<h1>Hello from [extendableTemplate]</h1>'
+ '<h1>Hello from [templateToInclude.mary]</h1>'
+ '<p></p>'
assert.equal(actual, expected);
this.uninstallTplAt(a);
this.uninstallTplAt(b);
this.uninstallTplAt(c);
}
}

@@ -353,0 +404,0 @@

Sorry, the diff of this file is not supported yet

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