From 569697f84eafeb04e142a2a80ab8a36ddf950bba Mon Sep 17 00:00:00 2001 From: Seth Kinast Date: Mon, 25 Jul 2016 15:46:24 -0700 Subject: [PATCH 1/5] Release v2.7.3 --- .travis.yml | 2 +- Gruntfile.js | 2 +- bower.json | 2 +- dist/dust-core.js | 6 +++--- dist/dust-core.min.js | 6 +++--- dist/dust-full.js | 6 +++--- dist/dust-full.min.js | 6 +++--- lib/dust.js | 2 +- package.json | 6 +++--- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index ee34cd6b..2632ffab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ notifications: - jchan@linkedin.com - skinast@linkedin.com before_install: - - npm install -g npm + - npm install -g npm@2 before_script: - npm update sudo: false diff --git a/Gruntfile.js b/Gruntfile.js index 8b4b799a..a6efcc92 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -119,7 +119,7 @@ module.exports = function(grunt) { testname: 'core', browsers: [ {browserName: 'chrome'}, - {browserName: 'firefox'}, + {browserName: 'firefox', platform: 'Windows 10'}, {browserName: 'safari', version: 7, platform: 'OS X 10.9'}, {browserName: 'safari', version: 6, platform: 'OS X 10.8'}, {browserName: 'internet explorer', version: 11, platform: 'Windows 8.1'}, diff --git a/bower.json b/bower.json index 912d7991..13021e95 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "dustjs-linkedin", - "version": "2.7.2", + "version": "2.7.3", "homepage": "https://github.com/linkedin/dustjs", "authors": [ "Veena Basavaraj ", diff --git a/dist/dust-core.js b/dist/dust-core.js index ce5e905c..1337433b 100644 --- a/dist/dust-core.js +++ b/dist/dust-core.js @@ -1,6 +1,6 @@ -/*! dustjs-linkedin - v2.7.2 +/*! dustjs-linkedin - v2.7.3 * http://dustjs.com/ -* Copyright (c) 2015 Aleksander Williams; Released under the MIT License */ +* Copyright (c) 2016 Aleksander Williams; Released under the MIT License */ (function (root, factory) { if (typeof define === 'function' && define.amd && define.amd.dust === true) { define('dust.core', [], factory); @@ -11,7 +11,7 @@ } }(this, function() { var dust = { - "version": "2.7.2" + "version": "2.7.3" }, NONE = 'NONE', ERROR = 'ERROR', WARN = 'WARN', INFO = 'INFO', DEBUG = 'DEBUG', EMPTY_FUNC = function() {}; diff --git a/dist/dust-core.min.js b/dist/dust-core.min.js index 18dec800..21957dde 100644 --- a/dist/dust-core.min.js +++ b/dist/dust-core.min.js @@ -1,4 +1,4 @@ -/*! dustjs-linkedin - v2.7.2 +/*! dustjs-linkedin - v2.7.3 * http://dustjs.com/ -* Copyright (c) 2015 Aleksander Williams; Released under the MIT License */ -!function(a,b){"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.core",[],b):"object"==typeof exports?module.exports=b():a.dust=b()}(this,function(){function getTemplate(a,b){return a?"function"==typeof a&&a.template?a.template:dust.isTemplateFn(a)?a:b!==!1?dust.cache[a]:void 0:void 0}function load(a,b,c){if(!a)return b.setError(new Error("No template or template name provided to render"));var d=getTemplate(a,dust.config.cache);return d?d(b,Context.wrap(c,d.templateName)):dust.onLoad?b.map(function(b){function d(a,d){var f;if(a)return b.setError(a);if(f=getTemplate(d,!1)||getTemplate(e,dust.config.cache),!f){if(!dust.compile)return b.setError(new Error("Dust compiler not available"));f=dust.loadSource(dust.compile(d,e))}f(b,Context.wrap(c,f.templateName)).end()}var e=a;3===dust.onLoad.length?dust.onLoad(e,c.options,d):dust.onLoad(e,d)}):b.setError(new Error("Template Not Found: "+a))}function Context(a,b,c,d,e){void 0===a||a instanceof Stack||(a=new Stack(a)),this.stack=a,this.global=b,this.options=c,this.blocks=d,this.templateName=e}function getWithResolvedData(a,b,c){return function(d){return a.push(d)._get(b,c)}}function Stack(a,b,c,d){this.tail=b,this.isObject=a&&"object"==typeof a,this.head=a,this.index=c,this.of=d}function Stub(a){this.head=new Chunk(this),this.callback=a,this.out=""}function Stream(){this.head=new Chunk(this)}function Chunk(a,b,c){this.root=a,this.next=b,this.data=[],this.flushable=!1,this.taps=c}function Tap(a,b){this.head=a,this.tail=b}var dust={version:"2.7.2"},NONE="NONE",ERROR="ERROR",WARN="WARN",INFO="INFO",DEBUG="DEBUG",EMPTY_FUNC=function(){};dust.config={whitespace:!1,amd:!1,cjs:!1,cache:!0},dust._aliases={write:"w",end:"e",map:"m",render:"r",reference:"f",section:"s",exists:"x",notexists:"nx",block:"b",partial:"p",helper:"h"},function(){var a,b,c={DEBUG:0,INFO:1,WARN:2,ERROR:3,NONE:4};"undefined"!=typeof console&&console.log?(a=console.log,b="function"==typeof a?function(){a.apply(console,arguments)}:function(){a(Array.prototype.slice.apply(arguments).join(" "))}):b=EMPTY_FUNC,dust.log=function(a,d){d=d||INFO,c[d]>=c[dust.debugLevel]&&b("[DUST:"+d+"]",a)},dust.debugLevel=NONE,"undefined"!=typeof process&&process.env&&/\bdust\b/.test(process.env.DEBUG)&&(dust.debugLevel=DEBUG)}(),dust.helpers={},dust.cache={},dust.register=function(a,b){a&&(b.templateName=a,dust.config.cache!==!1&&(dust.cache[a]=b))},dust.render=function(a,b,c){var d=new Stub(c).head;try{load(a,d,b).end()}catch(e){d.setError(e)}},dust.stream=function(a,b){var c=new Stream,d=c.head;return dust.nextTick(function(){try{load(a,d,b).end()}catch(c){d.setError(c)}}),c},dust.loadSource=function(source){return eval(source)},dust.isArray=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},dust.nextTick=function(){return function(a){setTimeout(a,0)}}(),dust.isEmpty=function(a){return 0===a?!1:dust.isArray(a)&&!a.length?!0:!a},dust.isEmptyObject=function(a){var b;if(null===a)return!1;if(void 0===a)return!1;if(a.length>0)return!1;for(b in a)if(Object.prototype.hasOwnProperty.call(a,b))return!1;return!0},dust.isTemplateFn=function(a){return"function"==typeof a&&a.__dustBody},dust.isThenable=function(a){return a&&"object"==typeof a&&"function"==typeof a.then},dust.isStreamable=function(a){return a&&"function"==typeof a.on&&"function"==typeof a.pipe},dust.filter=function(a,b,c,d){var e,f,g,h;if(c)for(e=0,f=c.length;f>e;e++)g=c[e],g.length&&(h=dust.filters[g],"s"===g?b=null:"function"==typeof h?a=h(a,d):dust.log("Invalid filter `"+g+"`",WARN));return b&&(a=dust.filters[b](a,d)),a},dust.filters={h:function(a){return dust.escapeHtml(a)},j:function(a){return dust.escapeJs(a)},u:encodeURI,uc:encodeURIComponent,js:function(a){return dust.escapeJSON(a)},jp:function(a){return JSON?JSON.parse(a):(dust.log("JSON is undefined; could not parse `"+a+"`",WARN),a)}},dust.makeBase=dust.context=function(a,b){return new Context(void 0,a,b)},Context.wrap=function(a,b){return a instanceof Context?a:new Context(a,{},{},null,b)},Context.prototype.get=function(a,b){return"string"==typeof a&&("."===a[0]&&(b=!0,a=a.substr(1)),a=a.split(".")),this._get(b,a)},Context.prototype._get=function(a,b){var c,d,e,f,g,h=this.stack||{},i=1;if(d=b[0],e=b.length,a&&0===e)f=h,h=h.head;else{if(a)h&&(h=h.head?h.head[d]:void 0);else{for(;h&&(!h.isObject||(f=h.head,c=h.head[d],void 0===c));)h=h.tail;h=void 0!==c?c:this.global&&this.global[d]}for(;h&&e>i;){if(dust.isThenable(h))return h.then(getWithResolvedData(this,a,b.slice(i)));f=h,h=h[b[i]],i++}}return"function"==typeof h?(g=function(){try{return h.apply(f,arguments)}catch(a){throw dust.log(a,ERROR),a}},g.__dustBody=!!h.__dustBody,g):(void 0===h&&dust.log("Cannot find reference `{"+b.join(".")+"}` in template `"+this.getTemplateName()+"`",INFO),h)},Context.prototype.getPath=function(a,b){return this._get(a,b)},Context.prototype.push=function(a,b,c){return void 0===a?(dust.log("Not pushing an undefined variable onto the context",INFO),this):this.rebase(new Stack(a,this.stack,b,c))},Context.prototype.pop=function(){var a=this.current();return this.stack=this.stack&&this.stack.tail,a},Context.prototype.rebase=function(a){return new Context(a,this.global,this.options,this.blocks,this.getTemplateName())},Context.prototype.clone=function(){var a=this.rebase();return a.stack=this.stack,a},Context.prototype.current=function(){return this.stack&&this.stack.head},Context.prototype.getBlock=function(a){var b,c,d;if("function"==typeof a&&(a=a(new Chunk,this).data.join("")),b=this.blocks,!b)return dust.log("No blocks for context `"+a+"` in template `"+this.getTemplateName()+"`",DEBUG),!1;for(c=b.length;c--;)if(d=b[c][a])return d;return dust.log("Malformed template `"+this.getTemplateName()+"` was missing one or more blocks."),!1},Context.prototype.shiftBlocks=function(a){var b,c=this.blocks;return a?(b=c?c.concat([a]):[a],new Context(this.stack,this.global,this.options,b,this.getTemplateName())):this},Context.prototype.resolve=function(a){var b;return"function"!=typeof a?a:(b=(new Chunk).render(a,this),b instanceof Chunk?b.data.join(""):b)},Context.prototype.getTemplateName=function(){return this.templateName},Stub.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.callback(a.error),dust.log("Rendering failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.out+=a.data.join(""),a=a.next,this.head=a}this.callback(null,this.out)},Stream.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.emit("error",a.error),this.emit("end"),dust.log("Streaming failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.emit("data",a.data.join("")),a=a.next,this.head=a}this.emit("end")},Stream.prototype.emit=function(a,b){var c,d,e=this.events||{},f=e[a]||[];if(!f.length)return dust.log("Stream broadcasting, but no listeners for `"+a+"`",DEBUG),!1;for(f=f.slice(0),c=0,d=f.length;d>c;c++)f[c](b);return!0},Stream.prototype.on=function(a,b){var c=this.events=this.events||{},d=c[a]=c[a]||[];return"function"!=typeof b?dust.log("No callback function provided for `"+a+"` event listener",WARN):d.push(b),this},Stream.prototype.pipe=function(a){if("function"!=typeof a.write||"function"!=typeof a.end)return dust.log("Incompatible stream passed to `pipe`",WARN),this;var b=!1;return"function"==typeof a.emit&&a.emit("pipe",this),"function"==typeof a.on&&a.on("error",function(){b=!0}),this.on("data",function(c){if(!b)try{a.write(c,"utf8")}catch(d){dust.log(d,ERROR)}}).on("end",function(){if(!b)try{a.end(),b=!0}catch(c){dust.log(c,ERROR)}})},Chunk.prototype.write=function(a){var b=this.taps;return b&&(a=b.go(a)),this.data.push(a),this},Chunk.prototype.end=function(a){return a&&this.write(a),this.flushable=!0,this.root.flush(),this},Chunk.prototype.map=function(a){var b=new Chunk(this.root,this.next,this.taps),c=new Chunk(this.root,b,this.taps);this.next=c,this.flushable=!0;try{a(c)}catch(d){dust.log(d,ERROR),c.setError(d)}return b},Chunk.prototype.tap=function(a){var b=this.taps;return this.taps=b?b.push(a):new Tap(a),this},Chunk.prototype.untap=function(){return this.taps=this.taps.tail,this},Chunk.prototype.render=function(a,b){return a(this,b)},Chunk.prototype.reference=function(a,b,c,d){return"function"==typeof a?(a=a.apply(b.current(),[this,b,null,{auto:c,filters:d}]),a instanceof Chunk?a:this.reference(a,b,c,d)):dust.isThenable(a)?this.await(a,b,null,c,d):dust.isStreamable(a)?this.stream(a,b,null,c,d):dust.isEmpty(a)?this:this.write(dust.filter(a,c,d,b))},Chunk.prototype.section=function(a,b,c,d){var e,f,g,h=c.block,i=c["else"],j=this;if("function"==typeof a&&!dust.isTemplateFn(a)){try{a=a.apply(b.current(),[this,b,c,d])}catch(k){return dust.log(k,ERROR),this.setError(k)}if(a instanceof Chunk)return a}if(dust.isEmptyObject(c))return j;if(dust.isEmptyObject(d)||(b=b.push(d)),dust.isArray(a)){if(h){if(f=a.length,f>0){for(g=b.stack&&b.stack.head||{},g.$len=f,e=0;f>e;e++)g.$idx=e,j=h(j,b.push(a[e],e,f));return g.$idx=void 0,g.$len=void 0,j}if(i)return i(this,b)}}else{if(dust.isThenable(a))return this.await(a,b,c);if(dust.isStreamable(a))return this.stream(a,b,c);if(a===!0){if(h)return h(this,b)}else if(a||0===a){if(h)return h(this,b.push(a))}else if(i)return i(this,b)}return dust.log("Section without corresponding key in template `"+b.getTemplateName()+"`",DEBUG),this},Chunk.prototype.exists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(e)return e(this,b)}else{if(d)return d(this,b);dust.log("No block for exists check in template `"+b.getTemplateName()+"`",DEBUG)}return this},Chunk.prototype.notexists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(d)return d(this,b);dust.log("No block for not-exists check in template `"+b.getTemplateName()+"`",DEBUG)}else if(e)return e(this,b);return this},Chunk.prototype.block=function(a,b,c){var d=a||c.block;return d?d(this,b):this},Chunk.prototype.partial=function(a,b,c,d){var e;return void 0===d&&(d=c,c=b),dust.isEmptyObject(d)||(c=c.clone(),e=c.pop(),c=c.push(d).push(e)),dust.isTemplateFn(a)?this.capture(a,b,function(a,b){c.templateName=a,load(a,b,c).end()}):(c.templateName=a,load(a,this,c))},Chunk.prototype.helper=function(a,b,c,d,e){var f,g=this,h=d.filters;if(void 0===e&&(e="h"),!dust.helpers[a])return dust.log("Helper `"+a+"` does not exist",WARN),g;try{return f=dust.helpers[a](g,b,c,d),f instanceof Chunk?f:("string"==typeof h&&(h=h.split("|")),dust.isEmptyObject(c)?g.reference(f,b,e,h):g.section(f,b,c,d))}catch(i){return dust.log("Error in helper `"+a+"`: "+i.message,ERROR),g.setError(i)}},Chunk.prototype.await=function(a,b,c,d,e){return this.map(function(f){a.then(function(a){f=c?f.section(a,b,c):f.reference(a,b,d,e),f.end()},function(a){var d=c&&c.error;d?f.render(d,b.push(a)).end():(dust.log("Unhandled promise rejection in `"+b.getTemplateName()+"`",INFO),f.end())})})},Chunk.prototype.stream=function(a,b,c,d,e){var f=c&&c.block,g=c&&c.error;return this.map(function(h){var i=!1;a.on("data",function(a){i||(f?h=h.map(function(c){c.render(f,b.push(a)).end()}):c||(h=h.reference(a,b,d,e)))}).on("error",function(a){i||(g?h.render(g,b.push(a)):dust.log("Unhandled stream error in `"+b.getTemplateName()+"`",INFO),i||(i=!0,h.end()))}).on("end",function(){i||(i=!0,h.end())})})},Chunk.prototype.capture=function(a,b,c){return this.map(function(d){var e=new Stub(function(a,b){a?d.setError(a):c(b,d)});a(e.head,b).end()})},Chunk.prototype.setError=function(a){return this.error=a,this.root.flush(),this};for(var f in Chunk.prototype)dust._aliases[f]&&(Chunk.prototype[dust._aliases[f]]=Chunk.prototype[f]);Tap.prototype.push=function(a){return new Tap(a,this)},Tap.prototype.go=function(a){for(var b=this;b;)a=b.head(a),b=b.tail;return a};var HCHARS=/[&<>"']/,AMP=/&/g,LT=//g,QUOT=/\"/g,SQUOT=/\'/g;dust.escapeHtml=function(a){return"string"==typeof a||a&&"function"==typeof a.toString?("string"!=typeof a&&(a=a.toString()),HCHARS.test(a)?a.replace(AMP,"&").replace(LT,"<").replace(GT,">").replace(QUOT,""").replace(SQUOT,"'"):a):a};var BS=/\\/g,FS=/\//g,CR=/\r/g,LS=/\u2028/g,PS=/\u2029/g,NL=/\n/g,LF=/\f/g,SQ=/'/g,DQ=/"/g,TB=/\t/g;return dust.escapeJs=function(a){return"string"==typeof a?a.replace(BS,"\\\\").replace(FS,"\\/").replace(DQ,'\\"').replace(SQ,"\\'").replace(CR,"\\r").replace(LS,"\\u2028").replace(PS,"\\u2029").replace(NL,"\\n").replace(LF,"\\f").replace(TB,"\\t"):a},dust.escapeJSON=function(a){return JSON?JSON.stringify(a).replace(LS,"\\u2028").replace(PS,"\\u2029").replace(LT,"\\u003c"):(dust.log("JSON is undefined; could not escape `"+a+"`",WARN),a)},dust}),"function"==typeof define&&define.amd&&define.amd.dust===!0&&define(["require","dust.core"],function(require,dust){return dust.onLoad=function(a,b){require([a],function(){b()})},dust}); \ No newline at end of file +* Copyright (c) 2016 Aleksander Williams; Released under the MIT License */ +!function(a,b){"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.core",[],b):"object"==typeof exports?module.exports=b():a.dust=b()}(this,function(){function getTemplate(a,b){return a?"function"==typeof a&&a.template?a.template:dust.isTemplateFn(a)?a:b!==!1?dust.cache[a]:void 0:void 0}function load(a,b,c){if(!a)return b.setError(new Error("No template or template name provided to render"));var d=getTemplate(a,dust.config.cache);return d?d(b,Context.wrap(c,d.templateName)):dust.onLoad?b.map(function(b){function d(a,d){var f;if(a)return b.setError(a);if(f=getTemplate(d,!1)||getTemplate(e,dust.config.cache),!f){if(!dust.compile)return b.setError(new Error("Dust compiler not available"));f=dust.loadSource(dust.compile(d,e))}f(b,Context.wrap(c,f.templateName)).end()}var e=a;3===dust.onLoad.length?dust.onLoad(e,c.options,d):dust.onLoad(e,d)}):b.setError(new Error("Template Not Found: "+a))}function Context(a,b,c,d,e){void 0===a||a instanceof Stack||(a=new Stack(a)),this.stack=a,this.global=b,this.options=c,this.blocks=d,this.templateName=e}function getWithResolvedData(a,b,c){return function(d){return a.push(d)._get(b,c)}}function Stack(a,b,c,d){this.tail=b,this.isObject=a&&"object"==typeof a,this.head=a,this.index=c,this.of=d}function Stub(a){this.head=new Chunk(this),this.callback=a,this.out=""}function Stream(){this.head=new Chunk(this)}function Chunk(a,b,c){this.root=a,this.next=b,this.data=[],this.flushable=!1,this.taps=c}function Tap(a,b){this.head=a,this.tail=b}var dust={version:"2.7.3"},NONE="NONE",ERROR="ERROR",WARN="WARN",INFO="INFO",DEBUG="DEBUG",EMPTY_FUNC=function(){};dust.config={whitespace:!1,amd:!1,cjs:!1,cache:!0},dust._aliases={write:"w",end:"e",map:"m",render:"r",reference:"f",section:"s",exists:"x",notexists:"nx",block:"b",partial:"p",helper:"h"},function(){var a,b,c={DEBUG:0,INFO:1,WARN:2,ERROR:3,NONE:4};"undefined"!=typeof console&&console.log?(a=console.log,b="function"==typeof a?function(){a.apply(console,arguments)}:function(){a(Array.prototype.slice.apply(arguments).join(" "))}):b=EMPTY_FUNC,dust.log=function(a,d){d=d||INFO,c[d]>=c[dust.debugLevel]&&b("[DUST:"+d+"]",a)},dust.debugLevel=NONE,"undefined"!=typeof process&&process.env&&/\bdust\b/.test(process.env.DEBUG)&&(dust.debugLevel=DEBUG)}(),dust.helpers={},dust.cache={},dust.register=function(a,b){a&&(b.templateName=a,dust.config.cache!==!1&&(dust.cache[a]=b))},dust.render=function(a,b,c){var d=new Stub(c).head;try{load(a,d,b).end()}catch(e){d.setError(e)}},dust.stream=function(a,b){var c=new Stream,d=c.head;return dust.nextTick(function(){try{load(a,d,b).end()}catch(c){d.setError(c)}}),c},dust.loadSource=function(source){return eval(source)},dust.isArray=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},dust.nextTick=function(){return function(a){setTimeout(a,0)}}(),dust.isEmpty=function(a){return 0===a?!1:dust.isArray(a)&&!a.length?!0:!a},dust.isEmptyObject=function(a){var b;if(null===a)return!1;if(void 0===a)return!1;if(a.length>0)return!1;for(b in a)if(Object.prototype.hasOwnProperty.call(a,b))return!1;return!0},dust.isTemplateFn=function(a){return"function"==typeof a&&a.__dustBody},dust.isThenable=function(a){return a&&"object"==typeof a&&"function"==typeof a.then},dust.isStreamable=function(a){return a&&"function"==typeof a.on&&"function"==typeof a.pipe},dust.filter=function(a,b,c,d){var e,f,g,h;if(c)for(e=0,f=c.length;f>e;e++)g=c[e],g.length&&(h=dust.filters[g],"s"===g?b=null:"function"==typeof h?a=h(a,d):dust.log("Invalid filter `"+g+"`",WARN));return b&&(a=dust.filters[b](a,d)),a},dust.filters={h:function(a){return dust.escapeHtml(a)},j:function(a){return dust.escapeJs(a)},u:encodeURI,uc:encodeURIComponent,js:function(a){return dust.escapeJSON(a)},jp:function(a){return JSON?JSON.parse(a):(dust.log("JSON is undefined; could not parse `"+a+"`",WARN),a)}},dust.makeBase=dust.context=function(a,b){return new Context(void 0,a,b)},Context.wrap=function(a,b){return a instanceof Context?a:new Context(a,{},{},null,b)},Context.prototype.get=function(a,b){return"string"==typeof a&&("."===a[0]&&(b=!0,a=a.substr(1)),a=a.split(".")),this._get(b,a)},Context.prototype._get=function(a,b){var c,d,e,f,g,h=this.stack||{},i=1;if(d=b[0],e=b.length,a&&0===e)f=h,h=h.head;else{if(a)h&&(h=h.head?h.head[d]:void 0);else{for(;h&&(!h.isObject||(f=h.head,c=h.head[d],void 0===c));)h=h.tail;h=void 0!==c?c:this.global&&this.global[d]}for(;h&&e>i;){if(dust.isThenable(h))return h.then(getWithResolvedData(this,a,b.slice(i)));f=h,h=h[b[i]],i++}}return"function"==typeof h?(g=function(){try{return h.apply(f,arguments)}catch(a){throw dust.log(a,ERROR),a}},g.__dustBody=!!h.__dustBody,g):(void 0===h&&dust.log("Cannot find reference `{"+b.join(".")+"}` in template `"+this.getTemplateName()+"`",INFO),h)},Context.prototype.getPath=function(a,b){return this._get(a,b)},Context.prototype.push=function(a,b,c){return void 0===a?(dust.log("Not pushing an undefined variable onto the context",INFO),this):this.rebase(new Stack(a,this.stack,b,c))},Context.prototype.pop=function(){var a=this.current();return this.stack=this.stack&&this.stack.tail,a},Context.prototype.rebase=function(a){return new Context(a,this.global,this.options,this.blocks,this.getTemplateName())},Context.prototype.clone=function(){var a=this.rebase();return a.stack=this.stack,a},Context.prototype.current=function(){return this.stack&&this.stack.head},Context.prototype.getBlock=function(a){var b,c,d;if("function"==typeof a&&(a=a(new Chunk,this).data.join("")),b=this.blocks,!b)return dust.log("No blocks for context `"+a+"` in template `"+this.getTemplateName()+"`",DEBUG),!1;for(c=b.length;c--;)if(d=b[c][a])return d;return dust.log("Malformed template `"+this.getTemplateName()+"` was missing one or more blocks."),!1},Context.prototype.shiftBlocks=function(a){var b,c=this.blocks;return a?(b=c?c.concat([a]):[a],new Context(this.stack,this.global,this.options,b,this.getTemplateName())):this},Context.prototype.resolve=function(a){var b;return"function"!=typeof a?a:(b=(new Chunk).render(a,this),b instanceof Chunk?b.data.join(""):b)},Context.prototype.getTemplateName=function(){return this.templateName},Stub.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.callback(a.error),dust.log("Rendering failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.out+=a.data.join(""),a=a.next,this.head=a}this.callback(null,this.out)},Stream.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.emit("error",a.error),this.emit("end"),dust.log("Streaming failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.emit("data",a.data.join("")),a=a.next,this.head=a}this.emit("end")},Stream.prototype.emit=function(a,b){var c,d,e=this.events||{},f=e[a]||[];if(!f.length)return dust.log("Stream broadcasting, but no listeners for `"+a+"`",DEBUG),!1;for(f=f.slice(0),c=0,d=f.length;d>c;c++)f[c](b);return!0},Stream.prototype.on=function(a,b){var c=this.events=this.events||{},d=c[a]=c[a]||[];return"function"!=typeof b?dust.log("No callback function provided for `"+a+"` event listener",WARN):d.push(b),this},Stream.prototype.pipe=function(a){if("function"!=typeof a.write||"function"!=typeof a.end)return dust.log("Incompatible stream passed to `pipe`",WARN),this;var b=!1;return"function"==typeof a.emit&&a.emit("pipe",this),"function"==typeof a.on&&a.on("error",function(){b=!0}),this.on("data",function(c){if(!b)try{a.write(c,"utf8")}catch(d){dust.log(d,ERROR)}}).on("end",function(){if(!b)try{a.end(),b=!0}catch(c){dust.log(c,ERROR)}})},Chunk.prototype.write=function(a){var b=this.taps;return b&&(a=b.go(a)),this.data.push(a),this},Chunk.prototype.end=function(a){return a&&this.write(a),this.flushable=!0,this.root.flush(),this},Chunk.prototype.map=function(a){var b=new Chunk(this.root,this.next,this.taps),c=new Chunk(this.root,b,this.taps);this.next=c,this.flushable=!0;try{a(c)}catch(d){dust.log(d,ERROR),c.setError(d)}return b},Chunk.prototype.tap=function(a){var b=this.taps;return this.taps=b?b.push(a):new Tap(a),this},Chunk.prototype.untap=function(){return this.taps=this.taps.tail,this},Chunk.prototype.render=function(a,b){return a(this,b)},Chunk.prototype.reference=function(a,b,c,d){return"function"==typeof a?(a=a.apply(b.current(),[this,b,null,{auto:c,filters:d}]),a instanceof Chunk?a:this.reference(a,b,c,d)):dust.isThenable(a)?this.await(a,b,null,c,d):dust.isStreamable(a)?this.stream(a,b,null,c,d):dust.isEmpty(a)?this:this.write(dust.filter(a,c,d,b))},Chunk.prototype.section=function(a,b,c,d){var e,f,g,h=c.block,i=c["else"],j=this;if("function"==typeof a&&!dust.isTemplateFn(a)){try{a=a.apply(b.current(),[this,b,c,d])}catch(k){return dust.log(k,ERROR),this.setError(k)}if(a instanceof Chunk)return a}if(dust.isEmptyObject(c))return j;if(dust.isEmptyObject(d)||(b=b.push(d)),dust.isArray(a)){if(h){if(f=a.length,f>0){for(g=b.stack&&b.stack.head||{},g.$len=f,e=0;f>e;e++)g.$idx=e,j=h(j,b.push(a[e],e,f));return g.$idx=void 0,g.$len=void 0,j}if(i)return i(this,b)}}else{if(dust.isThenable(a))return this.await(a,b,c);if(dust.isStreamable(a))return this.stream(a,b,c);if(a===!0){if(h)return h(this,b)}else if(a||0===a){if(h)return h(this,b.push(a))}else if(i)return i(this,b)}return dust.log("Section without corresponding key in template `"+b.getTemplateName()+"`",DEBUG),this},Chunk.prototype.exists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(e)return e(this,b)}else{if(d)return d(this,b);dust.log("No block for exists check in template `"+b.getTemplateName()+"`",DEBUG)}return this},Chunk.prototype.notexists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(d)return d(this,b);dust.log("No block for not-exists check in template `"+b.getTemplateName()+"`",DEBUG)}else if(e)return e(this,b);return this},Chunk.prototype.block=function(a,b,c){var d=a||c.block;return d?d(this,b):this},Chunk.prototype.partial=function(a,b,c,d){var e;return void 0===d&&(d=c,c=b),dust.isEmptyObject(d)||(c=c.clone(),e=c.pop(),c=c.push(d).push(e)),dust.isTemplateFn(a)?this.capture(a,b,function(a,b){c.templateName=a,load(a,b,c).end()}):(c.templateName=a,load(a,this,c))},Chunk.prototype.helper=function(a,b,c,d,e){var f,g=this,h=d.filters;if(void 0===e&&(e="h"),!dust.helpers[a])return dust.log("Helper `"+a+"` does not exist",WARN),g;try{return f=dust.helpers[a](g,b,c,d),f instanceof Chunk?f:("string"==typeof h&&(h=h.split("|")),dust.isEmptyObject(c)?g.reference(f,b,e,h):g.section(f,b,c,d))}catch(i){return dust.log("Error in helper `"+a+"`: "+i.message,ERROR),g.setError(i)}},Chunk.prototype.await=function(a,b,c,d,e){return this.map(function(f){a.then(function(a){f=c?f.section(a,b,c):f.reference(a,b,d,e),f.end()},function(a){var d=c&&c.error;d?f.render(d,b.push(a)).end():(dust.log("Unhandled promise rejection in `"+b.getTemplateName()+"`",INFO),f.end())})})},Chunk.prototype.stream=function(a,b,c,d,e){var f=c&&c.block,g=c&&c.error;return this.map(function(h){var i=!1;a.on("data",function(a){i||(f?h=h.map(function(c){c.render(f,b.push(a)).end()}):c||(h=h.reference(a,b,d,e)))}).on("error",function(a){i||(g?h.render(g,b.push(a)):dust.log("Unhandled stream error in `"+b.getTemplateName()+"`",INFO),i||(i=!0,h.end()))}).on("end",function(){i||(i=!0,h.end())})})},Chunk.prototype.capture=function(a,b,c){return this.map(function(d){var e=new Stub(function(a,b){a?d.setError(a):c(b,d)});a(e.head,b).end()})},Chunk.prototype.setError=function(a){return this.error=a,this.root.flush(),this};for(var f in Chunk.prototype)dust._aliases[f]&&(Chunk.prototype[dust._aliases[f]]=Chunk.prototype[f]);Tap.prototype.push=function(a){return new Tap(a,this)},Tap.prototype.go=function(a){for(var b=this;b;)a=b.head(a),b=b.tail;return a};var HCHARS=/[&<>"']/,AMP=/&/g,LT=//g,QUOT=/\"/g,SQUOT=/\'/g;dust.escapeHtml=function(a){return"string"==typeof a||a&&"function"==typeof a.toString?("string"!=typeof a&&(a=a.toString()),HCHARS.test(a)?a.replace(AMP,"&").replace(LT,"<").replace(GT,">").replace(QUOT,""").replace(SQUOT,"'"):a):a};var BS=/\\/g,FS=/\//g,CR=/\r/g,LS=/\u2028/g,PS=/\u2029/g,NL=/\n/g,LF=/\f/g,SQ=/'/g,DQ=/"/g,TB=/\t/g;return dust.escapeJs=function(a){return"string"==typeof a?a.replace(BS,"\\\\").replace(FS,"\\/").replace(DQ,'\\"').replace(SQ,"\\'").replace(CR,"\\r").replace(LS,"\\u2028").replace(PS,"\\u2029").replace(NL,"\\n").replace(LF,"\\f").replace(TB,"\\t"):a},dust.escapeJSON=function(a){return JSON?JSON.stringify(a).replace(LS,"\\u2028").replace(PS,"\\u2029").replace(LT,"\\u003c"):(dust.log("JSON is undefined; could not escape `"+a+"`",WARN),a)},dust}),"function"==typeof define&&define.amd&&define.amd.dust===!0&&define(["require","dust.core"],function(require,dust){return dust.onLoad=function(a,b){require([a],function(){b()})},dust}); \ No newline at end of file diff --git a/dist/dust-full.js b/dist/dust-full.js index a6bb344c..39728935 100644 --- a/dist/dust-full.js +++ b/dist/dust-full.js @@ -1,6 +1,6 @@ -/*! dustjs-linkedin - v2.7.2 +/*! dustjs-linkedin - v2.7.3 * http://dustjs.com/ -* Copyright (c) 2015 Aleksander Williams; Released under the MIT License */ +* Copyright (c) 2016 Aleksander Williams; Released under the MIT License */ (function (root, factory) { if (typeof define === 'function' && define.amd && define.amd.dust === true) { define('dust.core', [], factory); @@ -11,7 +11,7 @@ } }(this, function() { var dust = { - "version": "2.7.2" + "version": "2.7.3" }, NONE = 'NONE', ERROR = 'ERROR', WARN = 'WARN', INFO = 'INFO', DEBUG = 'DEBUG', EMPTY_FUNC = function() {}; diff --git a/dist/dust-full.min.js b/dist/dust-full.min.js index 5643b877..53ac6618 100644 --- a/dist/dust-full.min.js +++ b/dist/dust-full.min.js @@ -1,5 +1,5 @@ -/*! dustjs-linkedin - v2.7.2 +/*! dustjs-linkedin - v2.7.3 * http://dustjs.com/ -* Copyright (c) 2015 Aleksander Williams; Released under the MIT License */ -!function(a,b){"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.core",[],b):"object"==typeof exports?module.exports=b():a.dust=b()}(this,function(){function getTemplate(a,b){return a?"function"==typeof a&&a.template?a.template:dust.isTemplateFn(a)?a:b!==!1?dust.cache[a]:void 0:void 0}function load(a,b,c){if(!a)return b.setError(new Error("No template or template name provided to render"));var d=getTemplate(a,dust.config.cache);return d?d(b,Context.wrap(c,d.templateName)):dust.onLoad?b.map(function(b){function d(a,d){var f;if(a)return b.setError(a);if(f=getTemplate(d,!1)||getTemplate(e,dust.config.cache),!f){if(!dust.compile)return b.setError(new Error("Dust compiler not available"));f=dust.loadSource(dust.compile(d,e))}f(b,Context.wrap(c,f.templateName)).end()}var e=a;3===dust.onLoad.length?dust.onLoad(e,c.options,d):dust.onLoad(e,d)}):b.setError(new Error("Template Not Found: "+a))}function Context(a,b,c,d,e){void 0===a||a instanceof Stack||(a=new Stack(a)),this.stack=a,this.global=b,this.options=c,this.blocks=d,this.templateName=e}function getWithResolvedData(a,b,c){return function(d){return a.push(d)._get(b,c)}}function Stack(a,b,c,d){this.tail=b,this.isObject=a&&"object"==typeof a,this.head=a,this.index=c,this.of=d}function Stub(a){this.head=new Chunk(this),this.callback=a,this.out=""}function Stream(){this.head=new Chunk(this)}function Chunk(a,b,c){this.root=a,this.next=b,this.data=[],this.flushable=!1,this.taps=c}function Tap(a,b){this.head=a,this.tail=b}var dust={version:"2.7.2"},NONE="NONE",ERROR="ERROR",WARN="WARN",INFO="INFO",DEBUG="DEBUG",EMPTY_FUNC=function(){};dust.config={whitespace:!1,amd:!1,cjs:!1,cache:!0},dust._aliases={write:"w",end:"e",map:"m",render:"r",reference:"f",section:"s",exists:"x",notexists:"nx",block:"b",partial:"p",helper:"h"},function(){var a,b,c={DEBUG:0,INFO:1,WARN:2,ERROR:3,NONE:4};"undefined"!=typeof console&&console.log?(a=console.log,b="function"==typeof a?function(){a.apply(console,arguments)}:function(){a(Array.prototype.slice.apply(arguments).join(" "))}):b=EMPTY_FUNC,dust.log=function(a,d){d=d||INFO,c[d]>=c[dust.debugLevel]&&b("[DUST:"+d+"]",a)},dust.debugLevel=NONE,"undefined"!=typeof process&&process.env&&/\bdust\b/.test(process.env.DEBUG)&&(dust.debugLevel=DEBUG)}(),dust.helpers={},dust.cache={},dust.register=function(a,b){a&&(b.templateName=a,dust.config.cache!==!1&&(dust.cache[a]=b))},dust.render=function(a,b,c){var d=new Stub(c).head;try{load(a,d,b).end()}catch(e){d.setError(e)}},dust.stream=function(a,b){var c=new Stream,d=c.head;return dust.nextTick(function(){try{load(a,d,b).end()}catch(c){d.setError(c)}}),c},dust.loadSource=function(source){return eval(source)},dust.isArray=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},dust.nextTick=function(){return function(a){setTimeout(a,0)}}(),dust.isEmpty=function(a){return 0===a?!1:dust.isArray(a)&&!a.length?!0:!a},dust.isEmptyObject=function(a){var b;if(null===a)return!1;if(void 0===a)return!1;if(a.length>0)return!1;for(b in a)if(Object.prototype.hasOwnProperty.call(a,b))return!1;return!0},dust.isTemplateFn=function(a){return"function"==typeof a&&a.__dustBody},dust.isThenable=function(a){return a&&"object"==typeof a&&"function"==typeof a.then},dust.isStreamable=function(a){return a&&"function"==typeof a.on&&"function"==typeof a.pipe},dust.filter=function(a,b,c,d){var e,f,g,h;if(c)for(e=0,f=c.length;f>e;e++)g=c[e],g.length&&(h=dust.filters[g],"s"===g?b=null:"function"==typeof h?a=h(a,d):dust.log("Invalid filter `"+g+"`",WARN));return b&&(a=dust.filters[b](a,d)),a},dust.filters={h:function(a){return dust.escapeHtml(a)},j:function(a){return dust.escapeJs(a)},u:encodeURI,uc:encodeURIComponent,js:function(a){return dust.escapeJSON(a)},jp:function(a){return JSON?JSON.parse(a):(dust.log("JSON is undefined; could not parse `"+a+"`",WARN),a)}},dust.makeBase=dust.context=function(a,b){return new Context(void 0,a,b)},Context.wrap=function(a,b){return a instanceof Context?a:new Context(a,{},{},null,b)},Context.prototype.get=function(a,b){return"string"==typeof a&&("."===a[0]&&(b=!0,a=a.substr(1)),a=a.split(".")),this._get(b,a)},Context.prototype._get=function(a,b){var c,d,e,f,g,h=this.stack||{},i=1;if(d=b[0],e=b.length,a&&0===e)f=h,h=h.head;else{if(a)h&&(h=h.head?h.head[d]:void 0);else{for(;h&&(!h.isObject||(f=h.head,c=h.head[d],void 0===c));)h=h.tail;h=void 0!==c?c:this.global&&this.global[d]}for(;h&&e>i;){if(dust.isThenable(h))return h.then(getWithResolvedData(this,a,b.slice(i)));f=h,h=h[b[i]],i++}}return"function"==typeof h?(g=function(){try{return h.apply(f,arguments)}catch(a){throw dust.log(a,ERROR),a}},g.__dustBody=!!h.__dustBody,g):(void 0===h&&dust.log("Cannot find reference `{"+b.join(".")+"}` in template `"+this.getTemplateName()+"`",INFO),h)},Context.prototype.getPath=function(a,b){return this._get(a,b)},Context.prototype.push=function(a,b,c){return void 0===a?(dust.log("Not pushing an undefined variable onto the context",INFO),this):this.rebase(new Stack(a,this.stack,b,c))},Context.prototype.pop=function(){var a=this.current();return this.stack=this.stack&&this.stack.tail,a},Context.prototype.rebase=function(a){return new Context(a,this.global,this.options,this.blocks,this.getTemplateName())},Context.prototype.clone=function(){var a=this.rebase();return a.stack=this.stack,a},Context.prototype.current=function(){return this.stack&&this.stack.head},Context.prototype.getBlock=function(a){var b,c,d;if("function"==typeof a&&(a=a(new Chunk,this).data.join("")),b=this.blocks,!b)return dust.log("No blocks for context `"+a+"` in template `"+this.getTemplateName()+"`",DEBUG),!1;for(c=b.length;c--;)if(d=b[c][a])return d;return dust.log("Malformed template `"+this.getTemplateName()+"` was missing one or more blocks."),!1},Context.prototype.shiftBlocks=function(a){var b,c=this.blocks;return a?(b=c?c.concat([a]):[a],new Context(this.stack,this.global,this.options,b,this.getTemplateName())):this},Context.prototype.resolve=function(a){var b;return"function"!=typeof a?a:(b=(new Chunk).render(a,this),b instanceof Chunk?b.data.join(""):b)},Context.prototype.getTemplateName=function(){return this.templateName},Stub.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.callback(a.error),dust.log("Rendering failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.out+=a.data.join(""),a=a.next,this.head=a}this.callback(null,this.out)},Stream.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.emit("error",a.error),this.emit("end"),dust.log("Streaming failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.emit("data",a.data.join("")),a=a.next,this.head=a}this.emit("end")},Stream.prototype.emit=function(a,b){var c,d,e=this.events||{},f=e[a]||[];if(!f.length)return dust.log("Stream broadcasting, but no listeners for `"+a+"`",DEBUG),!1;for(f=f.slice(0),c=0,d=f.length;d>c;c++)f[c](b);return!0},Stream.prototype.on=function(a,b){var c=this.events=this.events||{},d=c[a]=c[a]||[];return"function"!=typeof b?dust.log("No callback function provided for `"+a+"` event listener",WARN):d.push(b),this},Stream.prototype.pipe=function(a){if("function"!=typeof a.write||"function"!=typeof a.end)return dust.log("Incompatible stream passed to `pipe`",WARN),this;var b=!1;return"function"==typeof a.emit&&a.emit("pipe",this),"function"==typeof a.on&&a.on("error",function(){b=!0}),this.on("data",function(c){if(!b)try{a.write(c,"utf8")}catch(d){dust.log(d,ERROR)}}).on("end",function(){if(!b)try{a.end(),b=!0}catch(c){dust.log(c,ERROR)}})},Chunk.prototype.write=function(a){var b=this.taps;return b&&(a=b.go(a)),this.data.push(a),this},Chunk.prototype.end=function(a){return a&&this.write(a),this.flushable=!0,this.root.flush(),this},Chunk.prototype.map=function(a){var b=new Chunk(this.root,this.next,this.taps),c=new Chunk(this.root,b,this.taps);this.next=c,this.flushable=!0;try{a(c)}catch(d){dust.log(d,ERROR),c.setError(d)}return b},Chunk.prototype.tap=function(a){var b=this.taps;return this.taps=b?b.push(a):new Tap(a),this},Chunk.prototype.untap=function(){return this.taps=this.taps.tail,this},Chunk.prototype.render=function(a,b){return a(this,b)},Chunk.prototype.reference=function(a,b,c,d){return"function"==typeof a?(a=a.apply(b.current(),[this,b,null,{auto:c,filters:d}]),a instanceof Chunk?a:this.reference(a,b,c,d)):dust.isThenable(a)?this.await(a,b,null,c,d):dust.isStreamable(a)?this.stream(a,b,null,c,d):dust.isEmpty(a)?this:this.write(dust.filter(a,c,d,b))},Chunk.prototype.section=function(a,b,c,d){var e,f,g,h=c.block,i=c["else"],j=this;if("function"==typeof a&&!dust.isTemplateFn(a)){try{a=a.apply(b.current(),[this,b,c,d])}catch(k){return dust.log(k,ERROR),this.setError(k)}if(a instanceof Chunk)return a}if(dust.isEmptyObject(c))return j;if(dust.isEmptyObject(d)||(b=b.push(d)),dust.isArray(a)){if(h){if(f=a.length,f>0){for(g=b.stack&&b.stack.head||{},g.$len=f,e=0;f>e;e++)g.$idx=e,j=h(j,b.push(a[e],e,f));return g.$idx=void 0,g.$len=void 0,j}if(i)return i(this,b)}}else{if(dust.isThenable(a))return this.await(a,b,c);if(dust.isStreamable(a))return this.stream(a,b,c);if(a===!0){if(h)return h(this,b)}else if(a||0===a){if(h)return h(this,b.push(a))}else if(i)return i(this,b)}return dust.log("Section without corresponding key in template `"+b.getTemplateName()+"`",DEBUG),this},Chunk.prototype.exists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(e)return e(this,b)}else{if(d)return d(this,b);dust.log("No block for exists check in template `"+b.getTemplateName()+"`",DEBUG)}return this},Chunk.prototype.notexists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(d)return d(this,b);dust.log("No block for not-exists check in template `"+b.getTemplateName()+"`",DEBUG)}else if(e)return e(this,b);return this},Chunk.prototype.block=function(a,b,c){var d=a||c.block;return d?d(this,b):this},Chunk.prototype.partial=function(a,b,c,d){var e;return void 0===d&&(d=c,c=b),dust.isEmptyObject(d)||(c=c.clone(),e=c.pop(),c=c.push(d).push(e)),dust.isTemplateFn(a)?this.capture(a,b,function(a,b){c.templateName=a,load(a,b,c).end()}):(c.templateName=a,load(a,this,c))},Chunk.prototype.helper=function(a,b,c,d,e){var f,g=this,h=d.filters;if(void 0===e&&(e="h"),!dust.helpers[a])return dust.log("Helper `"+a+"` does not exist",WARN),g;try{return f=dust.helpers[a](g,b,c,d),f instanceof Chunk?f:("string"==typeof h&&(h=h.split("|")),dust.isEmptyObject(c)?g.reference(f,b,e,h):g.section(f,b,c,d))}catch(i){return dust.log("Error in helper `"+a+"`: "+i.message,ERROR),g.setError(i)}},Chunk.prototype.await=function(a,b,c,d,e){return this.map(function(f){a.then(function(a){f=c?f.section(a,b,c):f.reference(a,b,d,e),f.end()},function(a){var d=c&&c.error;d?f.render(d,b.push(a)).end():(dust.log("Unhandled promise rejection in `"+b.getTemplateName()+"`",INFO),f.end())})})},Chunk.prototype.stream=function(a,b,c,d,e){var f=c&&c.block,g=c&&c.error;return this.map(function(h){var i=!1;a.on("data",function(a){i||(f?h=h.map(function(c){c.render(f,b.push(a)).end()}):c||(h=h.reference(a,b,d,e)))}).on("error",function(a){i||(g?h.render(g,b.push(a)):dust.log("Unhandled stream error in `"+b.getTemplateName()+"`",INFO),i||(i=!0,h.end()))}).on("end",function(){i||(i=!0,h.end())})})},Chunk.prototype.capture=function(a,b,c){return this.map(function(d){var e=new Stub(function(a,b){a?d.setError(a):c(b,d)});a(e.head,b).end()})},Chunk.prototype.setError=function(a){return this.error=a,this.root.flush(),this};for(var f in Chunk.prototype)dust._aliases[f]&&(Chunk.prototype[dust._aliases[f]]=Chunk.prototype[f]);Tap.prototype.push=function(a){return new Tap(a,this)},Tap.prototype.go=function(a){for(var b=this;b;)a=b.head(a),b=b.tail;return a};var HCHARS=/[&<>"']/,AMP=/&/g,LT=//g,QUOT=/\"/g,SQUOT=/\'/g;dust.escapeHtml=function(a){return"string"==typeof a||a&&"function"==typeof a.toString?("string"!=typeof a&&(a=a.toString()),HCHARS.test(a)?a.replace(AMP,"&").replace(LT,"<").replace(GT,">").replace(QUOT,""").replace(SQUOT,"'"):a):a};var BS=/\\/g,FS=/\//g,CR=/\r/g,LS=/\u2028/g,PS=/\u2029/g,NL=/\n/g,LF=/\f/g,SQ=/'/g,DQ=/"/g,TB=/\t/g;return dust.escapeJs=function(a){return"string"==typeof a?a.replace(BS,"\\\\").replace(FS,"\\/").replace(DQ,'\\"').replace(SQ,"\\'").replace(CR,"\\r").replace(LS,"\\u2028").replace(PS,"\\u2029").replace(NL,"\\n").replace(LF,"\\f").replace(TB,"\\t"):a},dust.escapeJSON=function(a){return JSON?JSON.stringify(a).replace(LS,"\\u2028").replace(PS,"\\u2029").replace(LT,"\\u003c"):(dust.log("JSON is undefined; could not escape `"+a+"`",WARN),a)},dust}),function(a,b){"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.parse",["dust.core"],function(dust){return b(dust).parse}):"object"==typeof exports?module.exports=b(require("./dust")):b(a.dust)}(this,function(dust){var a=function(){function a(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}function b(a,b,c,d,e,f){this.message=a,this.expected=b,this.found=c,this.offset=d,this.line=e,this.column=f,this.name="SyntaxError"}function c(a){function c(){return f(wc).line}function d(){return f(wc).column}function e(a){throw h(a,null,wc)}function f(b){function c(b,c,d){var e,f;for(e=c;d>e;e++)f=a.charAt(e),"\n"===f?(b.seenCR||b.line++,b.column=1,b.seenCR=!1):"\r"===f||"\u2028"===f||"\u2029"===f?(b.line++,b.column=1,b.seenCR=!0):(b.column++,b.seenCR=!1)}return xc!==b&&(xc>b&&(xc=0,yc={line:1,column:1,seenCR:!1}),c(yc,xc,b),xc=b),yc}function g(a){zc>vc||(vc>zc&&(zc=vc,Ac=[]),Ac.push(a))}function h(c,d,e){function g(a){var b=1;for(a.sort(function(a,b){return a.descriptionb.description?1:0});b1?g.slice(0,-1).join(", ")+" or "+g[a.length-1]:g[0],e=b?'"'+c(b)+'"':"end of input","Expected "+d+" but "+e+" found."}var i=f(e),j=evc?(j=a.charAt(vc),vc++):(j=X,0===Bc&&g(Eb)),j!==X?(wc=d,e=Fb(j),d=e):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa),d!==X)for(;d!==X;)c.push(d),d=vc,e=vc,Bc++,f=M(),Bc--,f===X?e=da:(vc=e,e=aa),e!==X?(f=vc,Bc++,h=K(),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(h=vc,Bc++,i=L(),Bc--,i===X?h=da:(vc=h,h=aa),h!==X?(i=vc,Bc++,j=R(),Bc--,j===X?i=da:(vc=i,i=aa),i!==X?(a.length>vc?(j=a.charAt(vc),vc++):(j=X,0===Bc&&g(Eb)),j!==X?(wc=d,e=Fb(j),d=e):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa);else c=aa;c!==X&&(wc=b,c=Gb(c)),b=c}return Bc--,b===X&&(c=X,0===Bc&&g(Cb)),b}function I(){var b,c,d,e,f;if(Bc++,b=vc,c=[],d=vc,e=vc,Bc++,f=M(),Bc--,f===X?e=da:(vc=e,e=aa),e!==X?(f=J(),f===X&&(Ib.test(a.charAt(vc))?(f=a.charAt(vc),vc++):(f=X,0===Bc&&g(Jb))),f!==X?(wc=d,e=Fb(f),d=e):(vc=d,d=aa)):(vc=d,d=aa),d!==X)for(;d!==X;)c.push(d),d=vc,e=vc,Bc++,f=M(),Bc--,f===X?e=da:(vc=e,e=aa),e!==X?(f=J(),f===X&&(Ib.test(a.charAt(vc))?(f=a.charAt(vc),vc++):(f=X,0===Bc&&g(Jb))),f!==X?(wc=d,e=Fb(f),d=e):(vc=d,d=aa)):(vc=d,d=aa);else c=aa;return c!==X&&(wc=b,c=Kb(c)),b=c,Bc--,b===X&&(c=X,0===Bc&&g(Hb)),b}function J(){var b,c;return b=vc,a.substr(vc,2)===Lb?(c=Lb,vc+=2):(c=X,0===Bc&&g(Mb)),c!==X&&(wc=b,c=Nb()),b=c}function K(){var b,c,d,e,f,h;if(Bc++,b=vc,a.substr(vc,2)===Pb?(c=Pb,vc+=2):(c=X,0===Bc&&g(Qb)),c!==X){for(d=[],e=vc,f=vc,Bc++,a.substr(vc,2)===Rb?(h=Rb,vc+=2):(h=X,0===Bc&&g(Sb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Tb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);e!==X;)d.push(e),e=vc,f=vc,Bc++,a.substr(vc,2)===Rb?(h=Rb,vc+=2):(h=X,0===Bc&&g(Sb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Tb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);d!==X?(a.substr(vc,2)===Rb?(e=Rb,vc+=2):(e=X,0===Bc&&g(Sb)),e!==X?(wc=b,c=Ub(d),b=c):(vc=b,b=aa)):(vc=b,b=aa)}else vc=b,b=aa;return Bc--,b===X&&(c=X,0===Bc&&g(Ob)),b}function L(){var b,c,d,e,f,h;if(Bc++,b=vc,a.substr(vc,2)===Wb?(c=Wb,vc+=2):(c=X,0===Bc&&g(Xb)),c!==X){for(d=[],e=vc,f=vc,Bc++,a.substr(vc,2)===Yb?(h=Yb,vc+=2):(h=X,0===Bc&&g(Zb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Fb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);e!==X;)d.push(e),e=vc,f=vc,Bc++,a.substr(vc,2)===Yb?(h=Yb,vc+=2):(h=X,0===Bc&&g(Zb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Fb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);d!==X?(a.substr(vc,2)===Yb?(e=Yb,vc+=2):(e=X,0===Bc&&g(Zb)),e!==X?(wc=b,c=$b(d),b=c):(vc=b,b=aa)):(vc=b,b=aa)}else vc=b,b=aa;return Bc--,b===X&&(c=X,0===Bc&&g(Vb)),b}function M(){var b,c,d,e,f,h,i,j,k,l;if(b=vc,c=N(),c!==X){for(d=[],e=S();e!==X;)d.push(e),e=S();if(d!==X)if(_b.test(a.charAt(vc))?(e=a.charAt(vc),vc++):(e=X,0===Bc&&g(ac)),e!==X){for(f=[],h=S();h!==X;)f.push(h),h=S();if(f!==X){if(h=[],i=vc,j=vc,Bc++,k=O(),Bc--,k===X?j=da:(vc=j,j=aa),j!==X?(k=vc,Bc++,l=R(),Bc--,l===X?k=da:(vc=k,k=aa),k!==X?(a.length>vc?(l=a.charAt(vc),vc++):(l=X,0===Bc&&g(Eb)),l!==X?(j=[j,k,l],i=j):(vc=i,i=aa)):(vc=i,i=aa)):(vc=i,i=aa),i!==X)for(;i!==X;)h.push(i),i=vc,j=vc,Bc++,k=O(),Bc--,k===X?j=da:(vc=j,j=aa),j!==X?(k=vc,Bc++,l=R(),Bc--,l===X?k=da:(vc=k,k=aa),k!==X?(a.length>vc?(l=a.charAt(vc),vc++):(l=X,0===Bc&&g(Eb)),l!==X?(j=[j,k,l],i=j):(vc=i,i=aa)):(vc=i,i=aa)):(vc=i,i=aa);else h=aa;if(h!==X){for(i=[],j=S();j!==X;)i.push(j),j=S();i!==X?(j=O(),j!==X?(c=[c,d,e,f,h,i,j],b=c):(vc=b,b=aa)):(vc=b,b=aa)}else vc=b,b=aa}else vc=b,b=aa}else vc=b,b=aa;else vc=b,b=aa}else vc=b,b=aa;return b===X&&(b=r()),b}function N(){var b;return 123===a.charCodeAt(vc)?(b=bc,vc++):(b=X,0===Bc&&g(cc)),b}function O(){var b;return 125===a.charCodeAt(vc)?(b=dc,vc++):(b=X,0===Bc&&g(ec)),b}function P(){var b;return 91===a.charCodeAt(vc)?(b=fc,vc++):(b=X,0===Bc&&g(gc)),b}function Q(){var b;return 93===a.charCodeAt(vc)?(b=hc,vc++):(b=X,0===Bc&&g(ic)),b}function R(){var b;return 10===a.charCodeAt(vc)?(b=jc,vc++):(b=X,0===Bc&&g(kc)),b===X&&(a.substr(vc,2)===lc?(b=lc,vc+=2):(b=X,0===Bc&&g(mc)),b===X&&(13===a.charCodeAt(vc)?(b=nc,vc++):(b=X,0===Bc&&g(oc)),b===X&&(8232===a.charCodeAt(vc)?(b=pc,vc++):(b=X,0===Bc&&g(qc)),b===X&&(8233===a.charCodeAt(vc)?(b=rc,vc++):(b=X,0===Bc&&g(sc)))))),b}function S(){var b;return tc.test(a.charAt(vc))?(b=a.charAt(vc),vc++):(b=X,0===Bc&&g(uc)),b===X&&(b=R()),b}function T(a){return parseInt(a.join(""),10)}function U(a){return a.concat([["line",c()],["col",d()]])}var V,W=arguments.length>1?arguments[1]:{},X={},Y={start:i},Z=i,$=function(a){var b=["body"].concat(a);return U(b)},_={type:"other",description:"section"},aa=X,ba=null,ca=function(a,b,c,d){return d&&a[1].text===d.text||e("Expected end tag for "+a[1].text+" but it was not found."),!0},da=void 0,ea=function(a,b,c){return c.push(["param",["literal","block"],b]),a.push(c,["filters"]),U(a)},fa="/",ga={type:"literal",value:"/",description:'"/"'},ha=function(a){return a.push(["bodies"],["filters"]),U(a)},ia=/^[#?\^<+@%]/,ja={type:"class",value:"[#?\\^<+@%]",description:"[#?\\^<+@%]"},ka=function(a,b,c,d){return[a,b,c,d]},la={type:"other",description:"end tag"},ma=function(a){return a},na=":",oa={type:"literal",value:":",description:'":"'},pa=function(a){return a},qa=function(a){return a?["context",a]:["context"]},ra={type:"other",description:"params"},sa="=",ta={type:"literal",value:"=",description:'"="'},ua=function(a,b){return["param",["literal",a],b]},va=function(a){return["params"].concat(a)},wa={type:"other",description:"bodies"},xa=function(a){return["bodies"].concat(a)},ya={type:"other",description:"reference"},za=function(a,b){return U(["reference",a,b])},Aa={type:"other",description:"partial"},Ba=">",Ca={type:"literal",value:">",description:'">"'},Da="+",Ea={type:"literal",value:"+",description:'"+"'},Fa=function(a){return["literal",a]},Ga=function(a,b,c,d){var e=">"===a?"partial":a;return U([e,b,c,d])},Ha={type:"other",description:"filters"},Ia="|",Ja={type:"literal",value:"|",description:'"|"'},Ka=function(a){return["filters"].concat(a)},La={type:"other",description:"special"},Ma="~",Na={type:"literal",value:"~",description:'"~"'},Oa=function(a){return U(["special",a])},Pa={type:"other",description:"identifier"},Qa=function(a){var b=["path"].concat(a);return b.text=a[1].join(".").replace(/,line,\d+,col,\d+/g,""),b},Ra=function(a){var b=["key",a];return b.text=a,b},Sa={type:"other",description:"number"},Ta=function(a){return["literal",a]},Ua={type:"other",description:"float"},Va=".",Wa={type:"literal",value:".",description:'"."'},Xa=function(a,b){return parseFloat(a+"."+b)},Ya={type:"other",description:"unsigned_integer"},Za=/^[0-9]/,$a={type:"class",value:"[0-9]",description:"[0-9]"},_a=function(a){return T(a)},ab={type:"other",description:"signed_integer"},bb="-",cb={type:"literal",value:"-",description:'"-"'},db=function(a,b){return-1*b},eb={type:"other",description:"integer"},fb={type:"other",description:"path"},gb=function(a,b){return b=b[0],a&&b?(b.unshift(a),U([!1,b])):U([!0,b])},hb=function(a){return U(a.length>0?[!0,a[0]]:[!0,[]])},ib={type:"other",description:"key"},jb=/^[a-zA-Z_$]/,kb={type:"class",value:"[a-zA-Z_$]",description:"[a-zA-Z_$]"},lb=/^[0-9a-zA-Z_$\-]/,mb={type:"class",value:"[0-9a-zA-Z_$\\-]",description:"[0-9a-zA-Z_$\\-]"},nb=function(a,b){return a+b.join("")},ob={type:"other",description:"array"},pb=function(a){return a.join("")},qb=function(a){return a},rb=function(a,b){return b?b.unshift(a):b=[a],b},sb={type:"other",description:"array_part"},tb=function(a){return a},ub=function(a,b){return b?a.concat(b):a},vb={type:"other",description:"inline"},wb='"',xb={type:"literal",value:'"',description:'"\\""'},yb=function(){return U(["literal",""])},zb=function(a){return U(["literal",a])},Ab=function(a){return U(["body"].concat(a))},Bb=function(a){return["buffer",a]},Cb={type:"other",description:"buffer"},Db=function(a,b){return U(["format",a,b.join("")])},Eb={type:"any",description:"any character"},Fb=function(a){return a},Gb=function(a){return U(["buffer",a.join("")])},Hb={type:"other",description:"literal"},Ib=/^[^"]/,Jb={type:"class",value:'[^"]',description:'[^"]'},Kb=function(a){return a.join("")},Lb='\\"',Mb={type:"literal",value:'\\"',description:'"\\\\\\""'},Nb=function(){return'"'},Ob={type:"other",description:"raw"},Pb="{`",Qb={type:"literal",value:"{`",description:'"{`"'},Rb="`}",Sb={type:"literal",value:"`}",description:'"`}"'},Tb=function(a){return a},Ub=function(a){return U(["raw",a.join("")])},Vb={type:"other",description:"comment"},Wb="{!",Xb={type:"literal",value:"{!",description:'"{!"'},Yb="!}",Zb={type:"literal",value:"!}",description:'"!}"'},$b=function(a){return U(["comment",a.join("")])},_b=/^[#?\^><+%:@\/~%]/,ac={type:"class",value:"[#?\\^><+%:@\\/~%]",description:"[#?\\^><+%:@\\/~%]"},bc="{",cc={type:"literal",value:"{",description:'"{"'},dc="}",ec={type:"literal",value:"}",description:'"}"'},fc="[",gc={type:"literal",value:"[",description:'"["'},hc="]",ic={type:"literal",value:"]",description:'"]"'},jc="\n",kc={type:"literal",value:"\n",description:'"\\n"'},lc="\r\n",mc={type:"literal", +* Copyright (c) 2016 Aleksander Williams; Released under the MIT License */ +!function(a,b){"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.core",[],b):"object"==typeof exports?module.exports=b():a.dust=b()}(this,function(){function getTemplate(a,b){return a?"function"==typeof a&&a.template?a.template:dust.isTemplateFn(a)?a:b!==!1?dust.cache[a]:void 0:void 0}function load(a,b,c){if(!a)return b.setError(new Error("No template or template name provided to render"));var d=getTemplate(a,dust.config.cache);return d?d(b,Context.wrap(c,d.templateName)):dust.onLoad?b.map(function(b){function d(a,d){var f;if(a)return b.setError(a);if(f=getTemplate(d,!1)||getTemplate(e,dust.config.cache),!f){if(!dust.compile)return b.setError(new Error("Dust compiler not available"));f=dust.loadSource(dust.compile(d,e))}f(b,Context.wrap(c,f.templateName)).end()}var e=a;3===dust.onLoad.length?dust.onLoad(e,c.options,d):dust.onLoad(e,d)}):b.setError(new Error("Template Not Found: "+a))}function Context(a,b,c,d,e){void 0===a||a instanceof Stack||(a=new Stack(a)),this.stack=a,this.global=b,this.options=c,this.blocks=d,this.templateName=e}function getWithResolvedData(a,b,c){return function(d){return a.push(d)._get(b,c)}}function Stack(a,b,c,d){this.tail=b,this.isObject=a&&"object"==typeof a,this.head=a,this.index=c,this.of=d}function Stub(a){this.head=new Chunk(this),this.callback=a,this.out=""}function Stream(){this.head=new Chunk(this)}function Chunk(a,b,c){this.root=a,this.next=b,this.data=[],this.flushable=!1,this.taps=c}function Tap(a,b){this.head=a,this.tail=b}var dust={version:"2.7.3"},NONE="NONE",ERROR="ERROR",WARN="WARN",INFO="INFO",DEBUG="DEBUG",EMPTY_FUNC=function(){};dust.config={whitespace:!1,amd:!1,cjs:!1,cache:!0},dust._aliases={write:"w",end:"e",map:"m",render:"r",reference:"f",section:"s",exists:"x",notexists:"nx",block:"b",partial:"p",helper:"h"},function(){var a,b,c={DEBUG:0,INFO:1,WARN:2,ERROR:3,NONE:4};"undefined"!=typeof console&&console.log?(a=console.log,b="function"==typeof a?function(){a.apply(console,arguments)}:function(){a(Array.prototype.slice.apply(arguments).join(" "))}):b=EMPTY_FUNC,dust.log=function(a,d){d=d||INFO,c[d]>=c[dust.debugLevel]&&b("[DUST:"+d+"]",a)},dust.debugLevel=NONE,"undefined"!=typeof process&&process.env&&/\bdust\b/.test(process.env.DEBUG)&&(dust.debugLevel=DEBUG)}(),dust.helpers={},dust.cache={},dust.register=function(a,b){a&&(b.templateName=a,dust.config.cache!==!1&&(dust.cache[a]=b))},dust.render=function(a,b,c){var d=new Stub(c).head;try{load(a,d,b).end()}catch(e){d.setError(e)}},dust.stream=function(a,b){var c=new Stream,d=c.head;return dust.nextTick(function(){try{load(a,d,b).end()}catch(c){d.setError(c)}}),c},dust.loadSource=function(source){return eval(source)},dust.isArray=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},dust.nextTick=function(){return function(a){setTimeout(a,0)}}(),dust.isEmpty=function(a){return 0===a?!1:dust.isArray(a)&&!a.length?!0:!a},dust.isEmptyObject=function(a){var b;if(null===a)return!1;if(void 0===a)return!1;if(a.length>0)return!1;for(b in a)if(Object.prototype.hasOwnProperty.call(a,b))return!1;return!0},dust.isTemplateFn=function(a){return"function"==typeof a&&a.__dustBody},dust.isThenable=function(a){return a&&"object"==typeof a&&"function"==typeof a.then},dust.isStreamable=function(a){return a&&"function"==typeof a.on&&"function"==typeof a.pipe},dust.filter=function(a,b,c,d){var e,f,g,h;if(c)for(e=0,f=c.length;f>e;e++)g=c[e],g.length&&(h=dust.filters[g],"s"===g?b=null:"function"==typeof h?a=h(a,d):dust.log("Invalid filter `"+g+"`",WARN));return b&&(a=dust.filters[b](a,d)),a},dust.filters={h:function(a){return dust.escapeHtml(a)},j:function(a){return dust.escapeJs(a)},u:encodeURI,uc:encodeURIComponent,js:function(a){return dust.escapeJSON(a)},jp:function(a){return JSON?JSON.parse(a):(dust.log("JSON is undefined; could not parse `"+a+"`",WARN),a)}},dust.makeBase=dust.context=function(a,b){return new Context(void 0,a,b)},Context.wrap=function(a,b){return a instanceof Context?a:new Context(a,{},{},null,b)},Context.prototype.get=function(a,b){return"string"==typeof a&&("."===a[0]&&(b=!0,a=a.substr(1)),a=a.split(".")),this._get(b,a)},Context.prototype._get=function(a,b){var c,d,e,f,g,h=this.stack||{},i=1;if(d=b[0],e=b.length,a&&0===e)f=h,h=h.head;else{if(a)h&&(h=h.head?h.head[d]:void 0);else{for(;h&&(!h.isObject||(f=h.head,c=h.head[d],void 0===c));)h=h.tail;h=void 0!==c?c:this.global&&this.global[d]}for(;h&&e>i;){if(dust.isThenable(h))return h.then(getWithResolvedData(this,a,b.slice(i)));f=h,h=h[b[i]],i++}}return"function"==typeof h?(g=function(){try{return h.apply(f,arguments)}catch(a){throw dust.log(a,ERROR),a}},g.__dustBody=!!h.__dustBody,g):(void 0===h&&dust.log("Cannot find reference `{"+b.join(".")+"}` in template `"+this.getTemplateName()+"`",INFO),h)},Context.prototype.getPath=function(a,b){return this._get(a,b)},Context.prototype.push=function(a,b,c){return void 0===a?(dust.log("Not pushing an undefined variable onto the context",INFO),this):this.rebase(new Stack(a,this.stack,b,c))},Context.prototype.pop=function(){var a=this.current();return this.stack=this.stack&&this.stack.tail,a},Context.prototype.rebase=function(a){return new Context(a,this.global,this.options,this.blocks,this.getTemplateName())},Context.prototype.clone=function(){var a=this.rebase();return a.stack=this.stack,a},Context.prototype.current=function(){return this.stack&&this.stack.head},Context.prototype.getBlock=function(a){var b,c,d;if("function"==typeof a&&(a=a(new Chunk,this).data.join("")),b=this.blocks,!b)return dust.log("No blocks for context `"+a+"` in template `"+this.getTemplateName()+"`",DEBUG),!1;for(c=b.length;c--;)if(d=b[c][a])return d;return dust.log("Malformed template `"+this.getTemplateName()+"` was missing one or more blocks."),!1},Context.prototype.shiftBlocks=function(a){var b,c=this.blocks;return a?(b=c?c.concat([a]):[a],new Context(this.stack,this.global,this.options,b,this.getTemplateName())):this},Context.prototype.resolve=function(a){var b;return"function"!=typeof a?a:(b=(new Chunk).render(a,this),b instanceof Chunk?b.data.join(""):b)},Context.prototype.getTemplateName=function(){return this.templateName},Stub.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.callback(a.error),dust.log("Rendering failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.out+=a.data.join(""),a=a.next,this.head=a}this.callback(null,this.out)},Stream.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.emit("error",a.error),this.emit("end"),dust.log("Streaming failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.emit("data",a.data.join("")),a=a.next,this.head=a}this.emit("end")},Stream.prototype.emit=function(a,b){var c,d,e=this.events||{},f=e[a]||[];if(!f.length)return dust.log("Stream broadcasting, but no listeners for `"+a+"`",DEBUG),!1;for(f=f.slice(0),c=0,d=f.length;d>c;c++)f[c](b);return!0},Stream.prototype.on=function(a,b){var c=this.events=this.events||{},d=c[a]=c[a]||[];return"function"!=typeof b?dust.log("No callback function provided for `"+a+"` event listener",WARN):d.push(b),this},Stream.prototype.pipe=function(a){if("function"!=typeof a.write||"function"!=typeof a.end)return dust.log("Incompatible stream passed to `pipe`",WARN),this;var b=!1;return"function"==typeof a.emit&&a.emit("pipe",this),"function"==typeof a.on&&a.on("error",function(){b=!0}),this.on("data",function(c){if(!b)try{a.write(c,"utf8")}catch(d){dust.log(d,ERROR)}}).on("end",function(){if(!b)try{a.end(),b=!0}catch(c){dust.log(c,ERROR)}})},Chunk.prototype.write=function(a){var b=this.taps;return b&&(a=b.go(a)),this.data.push(a),this},Chunk.prototype.end=function(a){return a&&this.write(a),this.flushable=!0,this.root.flush(),this},Chunk.prototype.map=function(a){var b=new Chunk(this.root,this.next,this.taps),c=new Chunk(this.root,b,this.taps);this.next=c,this.flushable=!0;try{a(c)}catch(d){dust.log(d,ERROR),c.setError(d)}return b},Chunk.prototype.tap=function(a){var b=this.taps;return this.taps=b?b.push(a):new Tap(a),this},Chunk.prototype.untap=function(){return this.taps=this.taps.tail,this},Chunk.prototype.render=function(a,b){return a(this,b)},Chunk.prototype.reference=function(a,b,c,d){return"function"==typeof a?(a=a.apply(b.current(),[this,b,null,{auto:c,filters:d}]),a instanceof Chunk?a:this.reference(a,b,c,d)):dust.isThenable(a)?this.await(a,b,null,c,d):dust.isStreamable(a)?this.stream(a,b,null,c,d):dust.isEmpty(a)?this:this.write(dust.filter(a,c,d,b))},Chunk.prototype.section=function(a,b,c,d){var e,f,g,h=c.block,i=c["else"],j=this;if("function"==typeof a&&!dust.isTemplateFn(a)){try{a=a.apply(b.current(),[this,b,c,d])}catch(k){return dust.log(k,ERROR),this.setError(k)}if(a instanceof Chunk)return a}if(dust.isEmptyObject(c))return j;if(dust.isEmptyObject(d)||(b=b.push(d)),dust.isArray(a)){if(h){if(f=a.length,f>0){for(g=b.stack&&b.stack.head||{},g.$len=f,e=0;f>e;e++)g.$idx=e,j=h(j,b.push(a[e],e,f));return g.$idx=void 0,g.$len=void 0,j}if(i)return i(this,b)}}else{if(dust.isThenable(a))return this.await(a,b,c);if(dust.isStreamable(a))return this.stream(a,b,c);if(a===!0){if(h)return h(this,b)}else if(a||0===a){if(h)return h(this,b.push(a))}else if(i)return i(this,b)}return dust.log("Section without corresponding key in template `"+b.getTemplateName()+"`",DEBUG),this},Chunk.prototype.exists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(e)return e(this,b)}else{if(d)return d(this,b);dust.log("No block for exists check in template `"+b.getTemplateName()+"`",DEBUG)}return this},Chunk.prototype.notexists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(d)return d(this,b);dust.log("No block for not-exists check in template `"+b.getTemplateName()+"`",DEBUG)}else if(e)return e(this,b);return this},Chunk.prototype.block=function(a,b,c){var d=a||c.block;return d?d(this,b):this},Chunk.prototype.partial=function(a,b,c,d){var e;return void 0===d&&(d=c,c=b),dust.isEmptyObject(d)||(c=c.clone(),e=c.pop(),c=c.push(d).push(e)),dust.isTemplateFn(a)?this.capture(a,b,function(a,b){c.templateName=a,load(a,b,c).end()}):(c.templateName=a,load(a,this,c))},Chunk.prototype.helper=function(a,b,c,d,e){var f,g=this,h=d.filters;if(void 0===e&&(e="h"),!dust.helpers[a])return dust.log("Helper `"+a+"` does not exist",WARN),g;try{return f=dust.helpers[a](g,b,c,d),f instanceof Chunk?f:("string"==typeof h&&(h=h.split("|")),dust.isEmptyObject(c)?g.reference(f,b,e,h):g.section(f,b,c,d))}catch(i){return dust.log("Error in helper `"+a+"`: "+i.message,ERROR),g.setError(i)}},Chunk.prototype.await=function(a,b,c,d,e){return this.map(function(f){a.then(function(a){f=c?f.section(a,b,c):f.reference(a,b,d,e),f.end()},function(a){var d=c&&c.error;d?f.render(d,b.push(a)).end():(dust.log("Unhandled promise rejection in `"+b.getTemplateName()+"`",INFO),f.end())})})},Chunk.prototype.stream=function(a,b,c,d,e){var f=c&&c.block,g=c&&c.error;return this.map(function(h){var i=!1;a.on("data",function(a){i||(f?h=h.map(function(c){c.render(f,b.push(a)).end()}):c||(h=h.reference(a,b,d,e)))}).on("error",function(a){i||(g?h.render(g,b.push(a)):dust.log("Unhandled stream error in `"+b.getTemplateName()+"`",INFO),i||(i=!0,h.end()))}).on("end",function(){i||(i=!0,h.end())})})},Chunk.prototype.capture=function(a,b,c){return this.map(function(d){var e=new Stub(function(a,b){a?d.setError(a):c(b,d)});a(e.head,b).end()})},Chunk.prototype.setError=function(a){return this.error=a,this.root.flush(),this};for(var f in Chunk.prototype)dust._aliases[f]&&(Chunk.prototype[dust._aliases[f]]=Chunk.prototype[f]);Tap.prototype.push=function(a){return new Tap(a,this)},Tap.prototype.go=function(a){for(var b=this;b;)a=b.head(a),b=b.tail;return a};var HCHARS=/[&<>"']/,AMP=/&/g,LT=//g,QUOT=/\"/g,SQUOT=/\'/g;dust.escapeHtml=function(a){return"string"==typeof a||a&&"function"==typeof a.toString?("string"!=typeof a&&(a=a.toString()),HCHARS.test(a)?a.replace(AMP,"&").replace(LT,"<").replace(GT,">").replace(QUOT,""").replace(SQUOT,"'"):a):a};var BS=/\\/g,FS=/\//g,CR=/\r/g,LS=/\u2028/g,PS=/\u2029/g,NL=/\n/g,LF=/\f/g,SQ=/'/g,DQ=/"/g,TB=/\t/g;return dust.escapeJs=function(a){return"string"==typeof a?a.replace(BS,"\\\\").replace(FS,"\\/").replace(DQ,'\\"').replace(SQ,"\\'").replace(CR,"\\r").replace(LS,"\\u2028").replace(PS,"\\u2029").replace(NL,"\\n").replace(LF,"\\f").replace(TB,"\\t"):a},dust.escapeJSON=function(a){return JSON?JSON.stringify(a).replace(LS,"\\u2028").replace(PS,"\\u2029").replace(LT,"\\u003c"):(dust.log("JSON is undefined; could not escape `"+a+"`",WARN),a)},dust}),function(a,b){"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.parse",["dust.core"],function(dust){return b(dust).parse}):"object"==typeof exports?module.exports=b(require("./dust")):b(a.dust)}(this,function(dust){var a=function(){function a(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}function b(a,b,c,d,e,f){this.message=a,this.expected=b,this.found=c,this.offset=d,this.line=e,this.column=f,this.name="SyntaxError"}function c(a){function c(){return f(wc).line}function d(){return f(wc).column}function e(a){throw h(a,null,wc)}function f(b){function c(b,c,d){var e,f;for(e=c;d>e;e++)f=a.charAt(e),"\n"===f?(b.seenCR||b.line++,b.column=1,b.seenCR=!1):"\r"===f||"\u2028"===f||"\u2029"===f?(b.line++,b.column=1,b.seenCR=!0):(b.column++,b.seenCR=!1)}return xc!==b&&(xc>b&&(xc=0,yc={line:1,column:1,seenCR:!1}),c(yc,xc,b),xc=b),yc}function g(a){zc>vc||(vc>zc&&(zc=vc,Ac=[]),Ac.push(a))}function h(c,d,e){function g(a){var b=1;for(a.sort(function(a,b){return a.descriptionb.description?1:0});b1?g.slice(0,-1).join(", ")+" or "+g[a.length-1]:g[0],e=b?'"'+c(b)+'"':"end of input","Expected "+d+" but "+e+" found."}var i=f(e),j=evc?(j=a.charAt(vc),vc++):(j=X,0===Bc&&g(Eb)),j!==X?(wc=d,e=Fb(j),d=e):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa),d!==X)for(;d!==X;)c.push(d),d=vc,e=vc,Bc++,f=M(),Bc--,f===X?e=da:(vc=e,e=aa),e!==X?(f=vc,Bc++,h=K(),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(h=vc,Bc++,i=L(),Bc--,i===X?h=da:(vc=h,h=aa),h!==X?(i=vc,Bc++,j=R(),Bc--,j===X?i=da:(vc=i,i=aa),i!==X?(a.length>vc?(j=a.charAt(vc),vc++):(j=X,0===Bc&&g(Eb)),j!==X?(wc=d,e=Fb(j),d=e):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa);else c=aa;c!==X&&(wc=b,c=Gb(c)),b=c}return Bc--,b===X&&(c=X,0===Bc&&g(Cb)),b}function I(){var b,c,d,e,f;if(Bc++,b=vc,c=[],d=vc,e=vc,Bc++,f=M(),Bc--,f===X?e=da:(vc=e,e=aa),e!==X?(f=J(),f===X&&(Ib.test(a.charAt(vc))?(f=a.charAt(vc),vc++):(f=X,0===Bc&&g(Jb))),f!==X?(wc=d,e=Fb(f),d=e):(vc=d,d=aa)):(vc=d,d=aa),d!==X)for(;d!==X;)c.push(d),d=vc,e=vc,Bc++,f=M(),Bc--,f===X?e=da:(vc=e,e=aa),e!==X?(f=J(),f===X&&(Ib.test(a.charAt(vc))?(f=a.charAt(vc),vc++):(f=X,0===Bc&&g(Jb))),f!==X?(wc=d,e=Fb(f),d=e):(vc=d,d=aa)):(vc=d,d=aa);else c=aa;return c!==X&&(wc=b,c=Kb(c)),b=c,Bc--,b===X&&(c=X,0===Bc&&g(Hb)),b}function J(){var b,c;return b=vc,a.substr(vc,2)===Lb?(c=Lb,vc+=2):(c=X,0===Bc&&g(Mb)),c!==X&&(wc=b,c=Nb()),b=c}function K(){var b,c,d,e,f,h;if(Bc++,b=vc,a.substr(vc,2)===Pb?(c=Pb,vc+=2):(c=X,0===Bc&&g(Qb)),c!==X){for(d=[],e=vc,f=vc,Bc++,a.substr(vc,2)===Rb?(h=Rb,vc+=2):(h=X,0===Bc&&g(Sb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Tb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);e!==X;)d.push(e),e=vc,f=vc,Bc++,a.substr(vc,2)===Rb?(h=Rb,vc+=2):(h=X,0===Bc&&g(Sb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Tb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);d!==X?(a.substr(vc,2)===Rb?(e=Rb,vc+=2):(e=X,0===Bc&&g(Sb)),e!==X?(wc=b,c=Ub(d),b=c):(vc=b,b=aa)):(vc=b,b=aa)}else vc=b,b=aa;return Bc--,b===X&&(c=X,0===Bc&&g(Ob)),b}function L(){var b,c,d,e,f,h;if(Bc++,b=vc,a.substr(vc,2)===Wb?(c=Wb,vc+=2):(c=X,0===Bc&&g(Xb)),c!==X){for(d=[],e=vc,f=vc,Bc++,a.substr(vc,2)===Yb?(h=Yb,vc+=2):(h=X,0===Bc&&g(Zb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Fb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);e!==X;)d.push(e),e=vc,f=vc,Bc++,a.substr(vc,2)===Yb?(h=Yb,vc+=2):(h=X,0===Bc&&g(Zb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Fb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);d!==X?(a.substr(vc,2)===Yb?(e=Yb,vc+=2):(e=X,0===Bc&&g(Zb)),e!==X?(wc=b,c=$b(d),b=c):(vc=b,b=aa)):(vc=b,b=aa)}else vc=b,b=aa;return Bc--,b===X&&(c=X,0===Bc&&g(Vb)),b}function M(){var b,c,d,e,f,h,i,j,k,l;if(b=vc,c=N(),c!==X){for(d=[],e=S();e!==X;)d.push(e),e=S();if(d!==X)if(_b.test(a.charAt(vc))?(e=a.charAt(vc),vc++):(e=X,0===Bc&&g(ac)),e!==X){for(f=[],h=S();h!==X;)f.push(h),h=S();if(f!==X){if(h=[],i=vc,j=vc,Bc++,k=O(),Bc--,k===X?j=da:(vc=j,j=aa),j!==X?(k=vc,Bc++,l=R(),Bc--,l===X?k=da:(vc=k,k=aa),k!==X?(a.length>vc?(l=a.charAt(vc),vc++):(l=X,0===Bc&&g(Eb)),l!==X?(j=[j,k,l],i=j):(vc=i,i=aa)):(vc=i,i=aa)):(vc=i,i=aa),i!==X)for(;i!==X;)h.push(i),i=vc,j=vc,Bc++,k=O(),Bc--,k===X?j=da:(vc=j,j=aa),j!==X?(k=vc,Bc++,l=R(),Bc--,l===X?k=da:(vc=k,k=aa),k!==X?(a.length>vc?(l=a.charAt(vc),vc++):(l=X,0===Bc&&g(Eb)),l!==X?(j=[j,k,l],i=j):(vc=i,i=aa)):(vc=i,i=aa)):(vc=i,i=aa);else h=aa;if(h!==X){for(i=[],j=S();j!==X;)i.push(j),j=S();i!==X?(j=O(),j!==X?(c=[c,d,e,f,h,i,j],b=c):(vc=b,b=aa)):(vc=b,b=aa)}else vc=b,b=aa}else vc=b,b=aa}else vc=b,b=aa;else vc=b,b=aa}else vc=b,b=aa;return b===X&&(b=r()),b}function N(){var b;return 123===a.charCodeAt(vc)?(b=bc,vc++):(b=X,0===Bc&&g(cc)),b}function O(){var b;return 125===a.charCodeAt(vc)?(b=dc,vc++):(b=X,0===Bc&&g(ec)),b}function P(){var b;return 91===a.charCodeAt(vc)?(b=fc,vc++):(b=X,0===Bc&&g(gc)),b}function Q(){var b;return 93===a.charCodeAt(vc)?(b=hc,vc++):(b=X,0===Bc&&g(ic)),b}function R(){var b;return 10===a.charCodeAt(vc)?(b=jc,vc++):(b=X,0===Bc&&g(kc)),b===X&&(a.substr(vc,2)===lc?(b=lc,vc+=2):(b=X,0===Bc&&g(mc)),b===X&&(13===a.charCodeAt(vc)?(b=nc,vc++):(b=X,0===Bc&&g(oc)),b===X&&(8232===a.charCodeAt(vc)?(b=pc,vc++):(b=X,0===Bc&&g(qc)),b===X&&(8233===a.charCodeAt(vc)?(b=rc,vc++):(b=X,0===Bc&&g(sc)))))),b}function S(){var b;return tc.test(a.charAt(vc))?(b=a.charAt(vc),vc++):(b=X,0===Bc&&g(uc)),b===X&&(b=R()),b}function T(a){return parseInt(a.join(""),10)}function U(a){return a.concat([["line",c()],["col",d()]])}var V,W=arguments.length>1?arguments[1]:{},X={},Y={start:i},Z=i,$=function(a){var b=["body"].concat(a);return U(b)},_={type:"other",description:"section"},aa=X,ba=null,ca=function(a,b,c,d){return d&&a[1].text===d.text||e("Expected end tag for "+a[1].text+" but it was not found."),!0},da=void 0,ea=function(a,b,c){return c.push(["param",["literal","block"],b]),a.push(c,["filters"]),U(a)},fa="/",ga={type:"literal",value:"/",description:'"/"'},ha=function(a){return a.push(["bodies"],["filters"]),U(a)},ia=/^[#?\^<+@%]/,ja={type:"class",value:"[#?\\^<+@%]",description:"[#?\\^<+@%]"},ka=function(a,b,c,d){return[a,b,c,d]},la={type:"other",description:"end tag"},ma=function(a){return a},na=":",oa={type:"literal",value:":",description:'":"'},pa=function(a){return a},qa=function(a){return a?["context",a]:["context"]},ra={type:"other",description:"params"},sa="=",ta={type:"literal",value:"=",description:'"="'},ua=function(a,b){return["param",["literal",a],b]},va=function(a){return["params"].concat(a)},wa={type:"other",description:"bodies"},xa=function(a){return["bodies"].concat(a)},ya={type:"other",description:"reference"},za=function(a,b){return U(["reference",a,b])},Aa={type:"other",description:"partial"},Ba=">",Ca={type:"literal",value:">",description:'">"'},Da="+",Ea={type:"literal",value:"+",description:'"+"'},Fa=function(a){return["literal",a]},Ga=function(a,b,c,d){var e=">"===a?"partial":a;return U([e,b,c,d])},Ha={type:"other",description:"filters"},Ia="|",Ja={type:"literal",value:"|",description:'"|"'},Ka=function(a){return["filters"].concat(a)},La={type:"other",description:"special"},Ma="~",Na={type:"literal",value:"~",description:'"~"'},Oa=function(a){return U(["special",a])},Pa={type:"other",description:"identifier"},Qa=function(a){var b=["path"].concat(a);return b.text=a[1].join(".").replace(/,line,\d+,col,\d+/g,""),b},Ra=function(a){var b=["key",a];return b.text=a,b},Sa={type:"other",description:"number"},Ta=function(a){return["literal",a]},Ua={type:"other",description:"float"},Va=".",Wa={type:"literal",value:".",description:'"."'},Xa=function(a,b){return parseFloat(a+"."+b)},Ya={type:"other",description:"unsigned_integer"},Za=/^[0-9]/,$a={type:"class",value:"[0-9]",description:"[0-9]"},_a=function(a){return T(a)},ab={type:"other",description:"signed_integer"},bb="-",cb={type:"literal",value:"-",description:'"-"'},db=function(a,b){return-1*b},eb={type:"other",description:"integer"},fb={type:"other",description:"path"},gb=function(a,b){return b=b[0],a&&b?(b.unshift(a),U([!1,b])):U([!0,b])},hb=function(a){return U(a.length>0?[!0,a[0]]:[!0,[]])},ib={type:"other",description:"key"},jb=/^[a-zA-Z_$]/,kb={type:"class",value:"[a-zA-Z_$]",description:"[a-zA-Z_$]"},lb=/^[0-9a-zA-Z_$\-]/,mb={type:"class",value:"[0-9a-zA-Z_$\\-]",description:"[0-9a-zA-Z_$\\-]"},nb=function(a,b){return a+b.join("")},ob={type:"other",description:"array"},pb=function(a){return a.join("")},qb=function(a){return a},rb=function(a,b){return b?b.unshift(a):b=[a],b},sb={type:"other",description:"array_part"},tb=function(a){return a},ub=function(a,b){return b?a.concat(b):a},vb={type:"other",description:"inline"},wb='"',xb={type:"literal",value:'"',description:'"\\""'},yb=function(){return U(["literal",""])},zb=function(a){return U(["literal",a])},Ab=function(a){return U(["body"].concat(a))},Bb=function(a){return["buffer",a]},Cb={type:"other",description:"buffer"},Db=function(a,b){return U(["format",a,b.join("")])},Eb={type:"any",description:"any character"},Fb=function(a){return a},Gb=function(a){return U(["buffer",a.join("")])},Hb={type:"other",description:"literal"},Ib=/^[^"]/,Jb={type:"class",value:'[^"]',description:'[^"]'},Kb=function(a){return a.join("")},Lb='\\"',Mb={type:"literal",value:'\\"',description:'"\\\\\\""'},Nb=function(){return'"'},Ob={type:"other",description:"raw"},Pb="{`",Qb={type:"literal",value:"{`",description:'"{`"'},Rb="`}",Sb={type:"literal",value:"`}",description:'"`}"'},Tb=function(a){return a},Ub=function(a){return U(["raw",a.join("")])},Vb={type:"other",description:"comment"},Wb="{!",Xb={type:"literal",value:"{!",description:'"{!"'},Yb="!}",Zb={type:"literal",value:"!}",description:'"!}"'},$b=function(a){return U(["comment",a.join("")])},_b=/^[#?\^><+%:@\/~%]/,ac={type:"class",value:"[#?\\^><+%:@\\/~%]",description:"[#?\\^><+%:@\\/~%]"},bc="{",cc={type:"literal",value:"{",description:'"{"'},dc="}",ec={type:"literal",value:"}",description:'"}"'},fc="[",gc={type:"literal",value:"[",description:'"["'},hc="]",ic={type:"literal",value:"]",description:'"]"'},jc="\n",kc={type:"literal",value:"\n",description:'"\\n"'},lc="\r\n",mc={type:"literal", value:"\r\n",description:'"\\r\\n"'},nc="\r",oc={type:"literal",value:"\r",description:'"\\r"'},pc="\u2028",qc={type:"literal",value:"\u2028",description:'"\\u2028"'},rc="\u2029",sc={type:"literal",value:"\u2029",description:'"\\u2029"'},tc=/^[\t\x0B\f \xA0\uFEFF]/,uc={type:"class",value:"[\\t\\x0B\\f \\xA0\\uFEFF]",description:"[\\t\\x0B\\f \\xA0\\uFEFF]"},vc=0,wc=0,xc=0,yc={line:1,column:1,seenCR:!1},zc=0,Ac=[],Bc=0;if("startRule"in W){if(!(W.startRule in Y))throw new Error("Can't start parsing from rule \""+W.startRule+'".');Z=Y[W.startRule]}if(V=Z(),V!==X&&vc===a.length)return V;throw V!==X&&vcc;c++)e=r.filterNode(a,b[c]),e&&f.push(e);return f}function d(a,b){var c,d,e,f,g=[b[0]];for(d=1,e=b.length;e>d;d++)f=r.filterNode(a,b[d]),f&&("buffer"===f[0]||"format"===f[0]?c?(c[0]="buffer"===f[0]?"buffer":c[0],c[1]+=f.slice(1,-2).join("")):(c=f,g.push(f)):(c=null,g.push(f)));return g}function e(a,b){return["buffer",t[b[1]],b[2],b[3]]}function f(a,b){return b}function g(){}function h(a,b){return dust.config.whitespace?(b.splice(1,2,b.slice(1,-2).join("")),b):null}function i(a,b){var c,d={name:b,bodies:[],blocks:{},index:0,auto:"h"},e=dust.escapeJs(b),f=b?'"'+e+'",':"",g="function(dust){",h=r.compileNode(d,a);return b&&(g+='dust.register("'+e+'",'+h+");"),g+=j(d)+k(d)+"return "+h+"}",c="("+g+"(dust));",dust.config.amd?"define("+f+'["dust.core"],'+g+");":dust.config.cjs?"module.exports=function(dust){var tmpl="+c+"var f="+q().toString()+";f.template=tmpl;return f}":c}function j(a){var b,c=[],d=a.blocks;for(b in d)c.push('"'+b+'":'+d[b]);return c.length?(a.blocks="ctx=ctx.shiftBlocks(blocks);","var blocks={"+c.join(",")+"};"):(a.blocks="",a.blocks)}function k(a){var b,c,d=[],e=a.bodies,f=a.blocks;for(b=0,c=e.length;c>b;b++)d[b]="function body_"+b+"(chk,ctx){"+f+"return chk"+e[b]+";}body_"+b+".__dustBody=!0;";return d.join("")}function l(a,b){var c,d,e="";for(c=1,d=b.length;d>c;c++)e+=r.compileNode(a,b[c]);return e}function m(a,b,c){return"."+(dust._aliases[c]||c)+"("+r.compileNode(a,b[1])+","+r.compileNode(a,b[2])+","+r.compileNode(a,b[4])+","+r.compileNode(a,b[3])+")"}function n(a){return a.replace(u,"\\\\").replace(v,'\\"').replace(w,"\\f").replace(x,"\\n").replace(y,"\\r").replace(z,"\\t")}function o(a,b,c){var d=dust.loadSource(dust.compile(a));return q(d)(b,c)}function p(a,b){var c=dust.loadSource(dust.compile(a,b));return q(c)}function q(a){return function(b,c){var d=c?"render":"stream";return dust[d](a,b,c)}}var r={},s=dust.isArray;r.compile=function(c,d){try{var e=b(a(c));return i(e,d)}catch(f){if(!f.line||!f.column)throw f;throw new SyntaxError(f.message+" At line : "+f.line+", column : "+f.column)}},r.filterNode=function(a,b){return r.optimizers[b[0]](a,b)},r.optimizers={body:d,buffer:f,special:e,format:h,reference:c,"#":c,"?":c,"^":c,"<":c,"+":c,"@":c,"%":c,partial:c,context:c,params:c,bodies:c,param:c,filters:f,key:f,path:f,literal:f,raw:f,comment:g,line:g,col:g},r.pragmas={esc:function(a,b,c){var d,e=a.auto;return b||(b="h"),a.auto="s"===b?"":b,d=l(a,c.block),a.auto=e,d}};var t={s:" ",n:"\n",r:"\r",lb:"{",rb:"}"};r.compileNode=function(a,b){return r.nodes[b[0]](a,b)},r.nodes={body:function(a,b){var c=a.index++,d="body_"+c;return a.bodies[c]=l(a,b),d},buffer:function(a,b){return".w("+A(b[1])+")"},format:function(a,b){return".w("+A(b[1])+")"},reference:function(a,b){return".f("+r.compileNode(a,b[1])+",ctx,"+r.compileNode(a,b[2])+")"},"#":function(a,b){return m(a,b,"section")},"?":function(a,b){return m(a,b,"exists")},"^":function(a,b){return m(a,b,"notexists")},"<":function(a,b){for(var c=b[4],d=1,e=c.length;e>d;d++){var f=c[d],g=f[1][1];if("block"===g)return a.blocks[b[1].text]=r.compileNode(a,f[2]),""}return""},"+":function(a,b){return"undefined"==typeof b[1].text&&"undefined"==typeof b[4]?".b(ctx.getBlock("+r.compileNode(a,b[1])+",chk, ctx),"+r.compileNode(a,b[2])+", {},"+r.compileNode(a,b[3])+")":".b(ctx.getBlock("+A(b[1].text)+"),"+r.compileNode(a,b[2])+","+r.compileNode(a,b[4])+","+r.compileNode(a,b[3])+")"},"@":function(a,b){return".h("+A(b[1].text)+","+r.compileNode(a,b[2])+","+r.compileNode(a,b[4])+","+r.compileNode(a,b[3])+","+r.compileNode(a,b[5])+")"},"%":function(a,b){var c,d,e,f,g,h,i,j,k,l=b[1][1];if(!r.pragmas[l])return"";for(c=b[4],d={},j=1,k=c.length;k>j;j++)h=c[j],d[h[1][1]]=h[2];for(e=b[3],f={},j=1,k=e.length;k>j;j++)i=e[j],f[i[1][1]]=i[2][1];return g=b[2][1]?b[2][1].text:null,r.pragmas[l](a,g,d,f)},partial:function(a,b){return".p("+r.compileNode(a,b[1])+",ctx,"+r.compileNode(a,b[2])+","+r.compileNode(a,b[3])+")"},context:function(a,b){return b[1]?"ctx.rebase("+r.compileNode(a,b[1])+")":"ctx"},params:function(a,b){for(var c=[],d=1,e=b.length;e>d;d++)c.push(r.compileNode(a,b[d]));return c.length?"{"+c.join(",")+"}":"{}"},bodies:function(a,b){for(var c=[],d=1,e=b.length;e>d;d++)c.push(r.compileNode(a,b[d]));return"{"+c.join(",")+"}"},param:function(a,b){return r.compileNode(a,b[1])+":"+r.compileNode(a,b[2])},filters:function(a,b){for(var c=[],d=1,e=b.length;e>d;d++){var f=b[d];c.push('"'+f+'"')}return'"'+a.auto+'"'+(c.length?",["+c.join(",")+"]":"")},key:function(a,b){return'ctx.get(["'+b[1]+'"], false)'},path:function(a,b){for(var c=b[1],d=b[2],e=[],f=0,g=d.length;g>f;f++)e.push(s(d[f])?r.compileNode(a,d[f]):'"'+d[f]+'"');return"ctx.getPath("+c+", ["+e.join(",")+"])"},literal:function(a,b){return A(b[1])},raw:function(a,b){return".w("+A(b[1])+")"}};var u=/\\/g,v=/"/g,w=/\f/g,x=/\n/g,y=/\r/g,z=/\t/g,A="undefined"==typeof JSON?function(a){return'"'+n(a)+'"'}:JSON.stringify;return dust.compiler=r,dust.compile=dust.compiler.compile,dust.renderSource=o,dust.compileFn=p,dust.filterNode=r.filterNode,dust.optimizers=r.optimizers,dust.pragmas=r.pragmas,dust.compileNode=r.compileNode,dust.nodes=r.nodes,r}),"function"==typeof define&&define.amd&&define.amd.dust===!0&&define(["require","dust.core","dust.compile"],function(require,dust){return dust.onLoad=function(a,b){require([a],function(){b()})},dust}); \ No newline at end of file diff --git a/lib/dust.js b/lib/dust.js index f814e98f..42b155d2 100644 --- a/lib/dust.js +++ b/lib/dust.js @@ -8,7 +8,7 @@ } }(this, function() { var dust = { - "version": "2.7.2" + "version": "2.7.3" }, NONE = 'NONE', ERROR = 'ERROR', WARN = 'WARN', INFO = 'INFO', DEBUG = 'DEBUG', EMPTY_FUNC = function() {}; diff --git a/package.json b/package.json index 1a33a074..7fca29f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dustjs-linkedin", - "version": "2.7.2", + "version": "2.7.3", "author": { "name": "Aleksander Williams", "url": "http://akdubya.github.com/dustjs" @@ -39,8 +39,8 @@ "linkedin" ], "dependencies": { - "chokidar": "~1.0.1", - "cli": "~0.6.6" + "chokidar": "~1.5.1", + "cli": "~0.11.2" }, "devDependencies": { "ayepromise": "~1.1.1", From 14995d31550c90c259822c37e0bcb42af693c3c2 Mon Sep 17 00:00:00 2001 From: Seth Kinast Date: Sat, 10 Sep 2016 15:26:53 -0700 Subject: [PATCH 2/5] Don't use instanceof to determine if a Context is a Context --- lib/dust.js | 7 ++++++- test/core.spec.js | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/dust.js b/lib/dust.js index 42b155d2..3afdecc6 100644 --- a/lib/dust.js +++ b/lib/dust.js @@ -316,12 +316,17 @@ this.options = options; this.blocks = blocks; this.templateName = templateName; + this._isContext = true; } dust.makeBase = dust.context = function(global, options) { return new Context(undefined, global, options); }; + dust.isContext = function(obj) { + return typeof obj === "object" && obj._isContext === true; + }; + /** * Factory function that creates a closure scope around a Thenable-callback. * Returns a function that can be passed to a Thenable that will resume a @@ -335,7 +340,7 @@ } Context.wrap = function(context, name) { - if (context instanceof Context) { + if (dust.isContext(context)) { return context; } return new Context(context, {}, {}, null, name); diff --git a/test/core.spec.js b/test/core.spec.js index f4e11b18..8811e8da 100644 --- a/test/core.spec.js +++ b/test/core.spec.js @@ -55,6 +55,14 @@ expect(base.options.lang).toEqual(opts.lang); }); }); + + describe('prototype', function() { + var base = dust.context({ + sayHello: function() { return "Hello!"; } + }).push({ foo: 'bar' }); + var context = extend({}, base); + renderIt('survives having its prototype destroyed', '{sayHello} {foo}', context, 'Hello! bar'); + }); }); it("valid keys", function() { From 9a082074737ece2518502054dcb8e9e9c54fbdde Mon Sep 17 00:00:00 2001 From: Seth Kinast Date: Mon, 12 Sep 2016 19:50:24 -0700 Subject: [PATCH 3/5] Release v2.7.4 --- CHANGELOG.md | 23 +++++++++++++---------- bower.json | 2 +- dist/dust-core.js | 11 ++++++++--- dist/dust-core.min.js | 4 ++-- dist/dust-full.js | 11 ++++++++--- dist/dust-full.min.js | 6 +++--- lib/dust.js | 2 +- package.json | 2 +- 8 files changed, 37 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 078885e0..178eae29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,18 +1,21 @@ ## Change Log +### v2.7.4 (2016/09/13 02:50 +00:00) +- [#744](https://github.com/linkedin/dustjs/pull/744) Don't use instanceof to determine if a Context is a Context. Instead use a flag on the instance itself so it can survive object merges. (@sethkinast) + ### v2.7.2 (2015/06/08 20:41 +00:00) - [#673](https://github.com/linkedin/dustjs/pull/673) Pass the current context to filters (@sethkinast) -- [#676](https://github.com/linkedin/dustjs/pull/676) If a Promise is resolved with an array, iterate over it instead of rendering the whole array at once. Closes #674 (@sethkinast) -- [#647](https://github.com/linkedin/dustjs/pull/647) Allow helpers to return primitives Previously returning a primitive would crash rendering with no way to recover. You can still return a Chunk and do more complex work if you need to. Helpers act like references or sections depending on if they have a body. When they have no body, they act like a reference and look in `params.filters` for filters to use. When they have a body, they act like a section. You can return thenables and streams normally. {@return value="" filters="|s" /} {@return value=""}{.} World{/return} Closes #645 (@sethkinast) -- [#664](https://github.com/linkedin/dustjs/pull/664) Be slightly pickier about what Dust thinks a Stream is. Closes #663 (@sethkinast) +- [#676](https://github.com/linkedin/dustjs/pull/676) If a Promise is resolved with an array, iterate over it instead of rendering the whole array at once. Closes #674 (@sethkinast) +- [#647](https://github.com/linkedin/dustjs/pull/647) Allow helpers to return primitives Previously returning a primitive would crash rendering with no way to recover. You can still return a Chunk and do more complex work if you need to. Helpers act like references or sections depending on if they have a body. When they have no body, they act like a reference and look in `params.filters` for filters to use. When they have a body, they act like a section. You can return thenables and streams normally. {@return value="" filters="|s" /} {@return value=""}{.} World{/return} Closes #645 (@sethkinast) +- [#664](https://github.com/linkedin/dustjs/pull/664) Be slightly pickier about what Dust thinks a Stream is. Closes #663 (@sethkinast) - [#661](https://github.com/linkedin/dustjs/pull/661) Add saucelabs integration (@sethkinast) -- [#658](https://github.com/linkedin/dustjs/pull/658) Refactor testing frameworks Closes #649 Closes #602 Closes #642 (@sethkinast) -- [#660](https://github.com/linkedin/dustjs/pull/660) Grammar: s/char/character/ to avoid using a reserved name Closes #659 (@sethkinast) +- [#658](https://github.com/linkedin/dustjs/pull/658) Refactor testing frameworks Closes #649 Closes #602 Closes #642 (@sethkinast) +- [#660](https://github.com/linkedin/dustjs/pull/660) Grammar: s/char/character/ to avoid using a reserved name Closes #659 (@sethkinast) ### v2.7.1 (2015/04/30 20:32 +00:00) - [#655](https://github.com/linkedin/dustjs/pull/655) Update CommonJS example to make use of new onLoad behavior (@sethkinast) - [#653](https://github.com/linkedin/dustjs/pull/653) Fix array iteration when context is undefined (@sethkinast) -- [#641](https://github.com/linkedin/dustjs/pull/641) Add a `cb(null, compiledTemplate)` signature to `dust.onLoad` Calling the `onLoad` callback with a compiled template function will use this template to satisfy the load request. The template is not automatically registered under any name when passed to the callback, so the `onLoad` function should handle registration as it needs. `dust.cache` behavior has been changed slightly. Before, setting it to false would blow away the entire cache on every render. Now, setting it to false just prevents new templates from being added and cached templates from being used, but if it's set to true again previously-cached templates will be ready to use. (@sethkinast) +- [#641](https://github.com/linkedin/dustjs/pull/641) Add a `cb(null, compiledTemplate)` signature to `dust.onLoad` Calling the `onLoad` callback with a compiled template function will use this template to satisfy the load request. The template is not automatically registered under any name when passed to the callback, so the `onLoad` function should handle registration as it needs. `dust.cache` behavior has been changed slightly. Before, setting it to false would blow away the entire cache on every render. Now, setting it to false just prevents new templates from being added and cached templates from being used, but if it's set to true again previously-cached templates will be ready to use. (@sethkinast) - [#650](https://github.com/linkedin/dustjs/pull/650) Pin jasmine@2.2.x for grunt-jasmine-nodejs (@sethkinast) - [#646](https://github.com/linkedin/dustjs/pull/646) Update AMD and CommonJS examples (@sethkinast) - [#637](https://github.com/linkedin/dustjs/pull/637) CommonJS example (@sethkinast) @@ -24,7 +27,7 @@ - [#633](https://github.com/linkedin/dustjs/pull/633) Drop Node 0.8 (@sethkinast) - [#635](https://github.com/linkedin/dustjs/pull/635) Resolve dynamic partial names via original context (@sethkinast) - [#631](https://github.com/linkedin/dustjs/pull/631) Try to avoid creating Stacks with no content when possible (@sethkinast) -- [#613](https://github.com/linkedin/dustjs/pull/613) Refactor template compilation * `dust.render` and `dust.stream` now accept a compiled template function in addition to a template name. * `dust.compile` no longer requires a template name, and will compile an anonymous template without one (so `--name` is no longer required for dustc either) * `dust.load` is removed from the public API * `dust.renderSource` is moved to the compiler, so it's only included in dust-full now (Fixes #412) * `dust.compileFn` is moved to the compiler, so it's only included in dust-full now * add `dust.isTemplateFn` * add `dust.config.cache = true`, set to `false` to disable caching and load templates again every time (Fixes #451) * add `dust.config.cjs = false`, set to `true` to compile templates as CommonJS modules * add `--cjs` flag to `dustc` * Move a bunch of exposed compiler stuff under `dust.compiler` (but leave it exposed until 2.8) (@sethkinast) +- [#613](https://github.com/linkedin/dustjs/pull/613) Refactor template compilation * `dust.render` and `dust.stream` now accept a compiled template function in addition to a template name. * `dust.compile` no longer requires a template name, and will compile an anonymous template without one (so `--name` is no longer required for dustc either) * `dust.load` is removed from the public API * `dust.renderSource` is moved to the compiler, so it's only included in dust-full now (Fixes #412) * `dust.compileFn` is moved to the compiler, so it's only included in dust-full now * add `dust.isTemplateFn` * add `dust.config.cache = true`, set to `false` to disable caching and load templates again every time (Fixes #451) * add `dust.config.cjs = false`, set to `true` to compile templates as CommonJS modules * add `--cjs` flag to `dustc` * Move a bunch of exposed compiler stuff under `dust.compiler` (but leave it exposed until 2.8) (@sethkinast) - [#624](https://github.com/linkedin/dustjs/pull/624) dustc always creates templates with forward slashes (@sethkinast) - [#617](https://github.com/linkedin/dustjs/pull/617) Add `chunk.stream` to allow streamables in context (@sethkinast) - [#610](https://github.com/linkedin/dustjs/pull/610) clean up PEG grammar a little bit (@sethkinast) @@ -89,11 +92,11 @@ - [#493](https://github.com/linkedin/dustjs/pull/493) Update changelog to 2.4.0 (@prashn64) ### v2.4.0 (2014/06/11 01:32 +00:00) -- [#472](https://github.com/linkedin/dustjs/pull/472) #469 Prevent references from looking in the prototype. Previously, {arr.sort} was possible even if sort was not a function in the arr object, since it was looking in the Array prototype. (@jimmyhchan) +- [#472](https://github.com/linkedin/dustjs/pull/472) #469 Prevent references from looking in the prototype. Previously, {arr.sort} was possible even if sort was not a function in the arr object, since it was looking in the Array prototype. (@jimmyhchan) - [#441](https://github.com/linkedin/dustjs/pull/441) Make default params type to an object instead of null (@prashn64) - [#447](https://github.com/linkedin/dustjs/pull/447) deprecate the internal property context.isFunction. this is no longer needed. (@prashn64) - [#424](https://github.com/linkedin/dustjs/pull/424) Set up dev flow with grunt and fix coverage report (@kate2753) -- [#471](https://github.com/linkedin/dustjs/pull/471) Errors thrown from render will now call populate the error in the callback. Previously, thrown errors will immediately fail and not call the callback. Issue #381, Address #468: Errors thrown from stream now will invoke the `error` listener with the error object. Previously, these errors could not be caught and the process will hang. Deprecated/remove: `dust.onError`, `dust.silenceErrors`. To see runtime errors, look at the error in the callback. breaking change: `dust.log` with an error no longer throws that error (@prashn64) +- [#471](https://github.com/linkedin/dustjs/pull/471) Errors thrown from render will now call populate the error in the callback. Previously, thrown errors will immediately fail and not call the callback. Issue #381, Address #468: Errors thrown from stream now will invoke the `error` listener with the error object. Previously, these errors could not be caught and the process will hang. Deprecated/remove: `dust.onError`, `dust.silenceErrors`. To see runtime errors, look at the error in the callback. breaking change: `dust.log` with an error no longer throws that error (@prashn64) - [#475](https://github.com/linkedin/dustjs/pull/475) remove config set on before install for travis build (@prashn64) - [#474](https://github.com/linkedin/dustjs/pull/474) travis build fix for minimatch grunt module (@prashn64) - [#470](https://github.com/linkedin/dustjs/pull/470) Ensure client bundlers load only client-side code (@patrick-steele-idem) @@ -266,4 +269,4 @@ - [#9](https://github.com/linkedin/dustjs/pull/9) Update to 0.4.0 in dist so that docs are correct (@kmiyashiro) - [#5](https://github.com/linkedin/dustjs/pull/5) Quote 'if' helper, fixes #4 (@kmiyashiro) - [#3](https://github.com/linkedin/dustjs/pull/3) Gaurd against browsers (@Raynos) -- [#25](https://github.com/linkedin/dustjs/pull/25) process.binding('evals') is now require('vm') (@stonecobra) \ No newline at end of file +- [#25](https://github.com/linkedin/dustjs/pull/25) process.binding('evals') is now require('vm') (@stonecobra) diff --git a/bower.json b/bower.json index 13021e95..e1e1a057 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "dustjs-linkedin", - "version": "2.7.3", + "version": "2.7.4", "homepage": "https://github.com/linkedin/dustjs", "authors": [ "Veena Basavaraj ", diff --git a/dist/dust-core.js b/dist/dust-core.js index 1337433b..d6b37672 100644 --- a/dist/dust-core.js +++ b/dist/dust-core.js @@ -1,4 +1,4 @@ -/*! dustjs-linkedin - v2.7.3 +/*! dustjs-linkedin - v2.7.4 * http://dustjs.com/ * Copyright (c) 2016 Aleksander Williams; Released under the MIT License */ (function (root, factory) { @@ -11,7 +11,7 @@ } }(this, function() { var dust = { - "version": "2.7.3" + "version": "2.7.4" }, NONE = 'NONE', ERROR = 'ERROR', WARN = 'WARN', INFO = 'INFO', DEBUG = 'DEBUG', EMPTY_FUNC = function() {}; @@ -319,12 +319,17 @@ this.options = options; this.blocks = blocks; this.templateName = templateName; + this._isContext = true; } dust.makeBase = dust.context = function(global, options) { return new Context(undefined, global, options); }; + dust.isContext = function(obj) { + return typeof obj === "object" && obj._isContext === true; + }; + /** * Factory function that creates a closure scope around a Thenable-callback. * Returns a function that can be passed to a Thenable that will resume a @@ -338,7 +343,7 @@ } Context.wrap = function(context, name) { - if (context instanceof Context) { + if (dust.isContext(context)) { return context; } return new Context(context, {}, {}, null, name); diff --git a/dist/dust-core.min.js b/dist/dust-core.min.js index 21957dde..66d86013 100644 --- a/dist/dust-core.min.js +++ b/dist/dust-core.min.js @@ -1,4 +1,4 @@ -/*! dustjs-linkedin - v2.7.3 +/*! dustjs-linkedin - v2.7.4 * http://dustjs.com/ * Copyright (c) 2016 Aleksander Williams; Released under the MIT License */ -!function(a,b){"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.core",[],b):"object"==typeof exports?module.exports=b():a.dust=b()}(this,function(){function getTemplate(a,b){return a?"function"==typeof a&&a.template?a.template:dust.isTemplateFn(a)?a:b!==!1?dust.cache[a]:void 0:void 0}function load(a,b,c){if(!a)return b.setError(new Error("No template or template name provided to render"));var d=getTemplate(a,dust.config.cache);return d?d(b,Context.wrap(c,d.templateName)):dust.onLoad?b.map(function(b){function d(a,d){var f;if(a)return b.setError(a);if(f=getTemplate(d,!1)||getTemplate(e,dust.config.cache),!f){if(!dust.compile)return b.setError(new Error("Dust compiler not available"));f=dust.loadSource(dust.compile(d,e))}f(b,Context.wrap(c,f.templateName)).end()}var e=a;3===dust.onLoad.length?dust.onLoad(e,c.options,d):dust.onLoad(e,d)}):b.setError(new Error("Template Not Found: "+a))}function Context(a,b,c,d,e){void 0===a||a instanceof Stack||(a=new Stack(a)),this.stack=a,this.global=b,this.options=c,this.blocks=d,this.templateName=e}function getWithResolvedData(a,b,c){return function(d){return a.push(d)._get(b,c)}}function Stack(a,b,c,d){this.tail=b,this.isObject=a&&"object"==typeof a,this.head=a,this.index=c,this.of=d}function Stub(a){this.head=new Chunk(this),this.callback=a,this.out=""}function Stream(){this.head=new Chunk(this)}function Chunk(a,b,c){this.root=a,this.next=b,this.data=[],this.flushable=!1,this.taps=c}function Tap(a,b){this.head=a,this.tail=b}var dust={version:"2.7.3"},NONE="NONE",ERROR="ERROR",WARN="WARN",INFO="INFO",DEBUG="DEBUG",EMPTY_FUNC=function(){};dust.config={whitespace:!1,amd:!1,cjs:!1,cache:!0},dust._aliases={write:"w",end:"e",map:"m",render:"r",reference:"f",section:"s",exists:"x",notexists:"nx",block:"b",partial:"p",helper:"h"},function(){var a,b,c={DEBUG:0,INFO:1,WARN:2,ERROR:3,NONE:4};"undefined"!=typeof console&&console.log?(a=console.log,b="function"==typeof a?function(){a.apply(console,arguments)}:function(){a(Array.prototype.slice.apply(arguments).join(" "))}):b=EMPTY_FUNC,dust.log=function(a,d){d=d||INFO,c[d]>=c[dust.debugLevel]&&b("[DUST:"+d+"]",a)},dust.debugLevel=NONE,"undefined"!=typeof process&&process.env&&/\bdust\b/.test(process.env.DEBUG)&&(dust.debugLevel=DEBUG)}(),dust.helpers={},dust.cache={},dust.register=function(a,b){a&&(b.templateName=a,dust.config.cache!==!1&&(dust.cache[a]=b))},dust.render=function(a,b,c){var d=new Stub(c).head;try{load(a,d,b).end()}catch(e){d.setError(e)}},dust.stream=function(a,b){var c=new Stream,d=c.head;return dust.nextTick(function(){try{load(a,d,b).end()}catch(c){d.setError(c)}}),c},dust.loadSource=function(source){return eval(source)},dust.isArray=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},dust.nextTick=function(){return function(a){setTimeout(a,0)}}(),dust.isEmpty=function(a){return 0===a?!1:dust.isArray(a)&&!a.length?!0:!a},dust.isEmptyObject=function(a){var b;if(null===a)return!1;if(void 0===a)return!1;if(a.length>0)return!1;for(b in a)if(Object.prototype.hasOwnProperty.call(a,b))return!1;return!0},dust.isTemplateFn=function(a){return"function"==typeof a&&a.__dustBody},dust.isThenable=function(a){return a&&"object"==typeof a&&"function"==typeof a.then},dust.isStreamable=function(a){return a&&"function"==typeof a.on&&"function"==typeof a.pipe},dust.filter=function(a,b,c,d){var e,f,g,h;if(c)for(e=0,f=c.length;f>e;e++)g=c[e],g.length&&(h=dust.filters[g],"s"===g?b=null:"function"==typeof h?a=h(a,d):dust.log("Invalid filter `"+g+"`",WARN));return b&&(a=dust.filters[b](a,d)),a},dust.filters={h:function(a){return dust.escapeHtml(a)},j:function(a){return dust.escapeJs(a)},u:encodeURI,uc:encodeURIComponent,js:function(a){return dust.escapeJSON(a)},jp:function(a){return JSON?JSON.parse(a):(dust.log("JSON is undefined; could not parse `"+a+"`",WARN),a)}},dust.makeBase=dust.context=function(a,b){return new Context(void 0,a,b)},Context.wrap=function(a,b){return a instanceof Context?a:new Context(a,{},{},null,b)},Context.prototype.get=function(a,b){return"string"==typeof a&&("."===a[0]&&(b=!0,a=a.substr(1)),a=a.split(".")),this._get(b,a)},Context.prototype._get=function(a,b){var c,d,e,f,g,h=this.stack||{},i=1;if(d=b[0],e=b.length,a&&0===e)f=h,h=h.head;else{if(a)h&&(h=h.head?h.head[d]:void 0);else{for(;h&&(!h.isObject||(f=h.head,c=h.head[d],void 0===c));)h=h.tail;h=void 0!==c?c:this.global&&this.global[d]}for(;h&&e>i;){if(dust.isThenable(h))return h.then(getWithResolvedData(this,a,b.slice(i)));f=h,h=h[b[i]],i++}}return"function"==typeof h?(g=function(){try{return h.apply(f,arguments)}catch(a){throw dust.log(a,ERROR),a}},g.__dustBody=!!h.__dustBody,g):(void 0===h&&dust.log("Cannot find reference `{"+b.join(".")+"}` in template `"+this.getTemplateName()+"`",INFO),h)},Context.prototype.getPath=function(a,b){return this._get(a,b)},Context.prototype.push=function(a,b,c){return void 0===a?(dust.log("Not pushing an undefined variable onto the context",INFO),this):this.rebase(new Stack(a,this.stack,b,c))},Context.prototype.pop=function(){var a=this.current();return this.stack=this.stack&&this.stack.tail,a},Context.prototype.rebase=function(a){return new Context(a,this.global,this.options,this.blocks,this.getTemplateName())},Context.prototype.clone=function(){var a=this.rebase();return a.stack=this.stack,a},Context.prototype.current=function(){return this.stack&&this.stack.head},Context.prototype.getBlock=function(a){var b,c,d;if("function"==typeof a&&(a=a(new Chunk,this).data.join("")),b=this.blocks,!b)return dust.log("No blocks for context `"+a+"` in template `"+this.getTemplateName()+"`",DEBUG),!1;for(c=b.length;c--;)if(d=b[c][a])return d;return dust.log("Malformed template `"+this.getTemplateName()+"` was missing one or more blocks."),!1},Context.prototype.shiftBlocks=function(a){var b,c=this.blocks;return a?(b=c?c.concat([a]):[a],new Context(this.stack,this.global,this.options,b,this.getTemplateName())):this},Context.prototype.resolve=function(a){var b;return"function"!=typeof a?a:(b=(new Chunk).render(a,this),b instanceof Chunk?b.data.join(""):b)},Context.prototype.getTemplateName=function(){return this.templateName},Stub.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.callback(a.error),dust.log("Rendering failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.out+=a.data.join(""),a=a.next,this.head=a}this.callback(null,this.out)},Stream.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.emit("error",a.error),this.emit("end"),dust.log("Streaming failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.emit("data",a.data.join("")),a=a.next,this.head=a}this.emit("end")},Stream.prototype.emit=function(a,b){var c,d,e=this.events||{},f=e[a]||[];if(!f.length)return dust.log("Stream broadcasting, but no listeners for `"+a+"`",DEBUG),!1;for(f=f.slice(0),c=0,d=f.length;d>c;c++)f[c](b);return!0},Stream.prototype.on=function(a,b){var c=this.events=this.events||{},d=c[a]=c[a]||[];return"function"!=typeof b?dust.log("No callback function provided for `"+a+"` event listener",WARN):d.push(b),this},Stream.prototype.pipe=function(a){if("function"!=typeof a.write||"function"!=typeof a.end)return dust.log("Incompatible stream passed to `pipe`",WARN),this;var b=!1;return"function"==typeof a.emit&&a.emit("pipe",this),"function"==typeof a.on&&a.on("error",function(){b=!0}),this.on("data",function(c){if(!b)try{a.write(c,"utf8")}catch(d){dust.log(d,ERROR)}}).on("end",function(){if(!b)try{a.end(),b=!0}catch(c){dust.log(c,ERROR)}})},Chunk.prototype.write=function(a){var b=this.taps;return b&&(a=b.go(a)),this.data.push(a),this},Chunk.prototype.end=function(a){return a&&this.write(a),this.flushable=!0,this.root.flush(),this},Chunk.prototype.map=function(a){var b=new Chunk(this.root,this.next,this.taps),c=new Chunk(this.root,b,this.taps);this.next=c,this.flushable=!0;try{a(c)}catch(d){dust.log(d,ERROR),c.setError(d)}return b},Chunk.prototype.tap=function(a){var b=this.taps;return this.taps=b?b.push(a):new Tap(a),this},Chunk.prototype.untap=function(){return this.taps=this.taps.tail,this},Chunk.prototype.render=function(a,b){return a(this,b)},Chunk.prototype.reference=function(a,b,c,d){return"function"==typeof a?(a=a.apply(b.current(),[this,b,null,{auto:c,filters:d}]),a instanceof Chunk?a:this.reference(a,b,c,d)):dust.isThenable(a)?this.await(a,b,null,c,d):dust.isStreamable(a)?this.stream(a,b,null,c,d):dust.isEmpty(a)?this:this.write(dust.filter(a,c,d,b))},Chunk.prototype.section=function(a,b,c,d){var e,f,g,h=c.block,i=c["else"],j=this;if("function"==typeof a&&!dust.isTemplateFn(a)){try{a=a.apply(b.current(),[this,b,c,d])}catch(k){return dust.log(k,ERROR),this.setError(k)}if(a instanceof Chunk)return a}if(dust.isEmptyObject(c))return j;if(dust.isEmptyObject(d)||(b=b.push(d)),dust.isArray(a)){if(h){if(f=a.length,f>0){for(g=b.stack&&b.stack.head||{},g.$len=f,e=0;f>e;e++)g.$idx=e,j=h(j,b.push(a[e],e,f));return g.$idx=void 0,g.$len=void 0,j}if(i)return i(this,b)}}else{if(dust.isThenable(a))return this.await(a,b,c);if(dust.isStreamable(a))return this.stream(a,b,c);if(a===!0){if(h)return h(this,b)}else if(a||0===a){if(h)return h(this,b.push(a))}else if(i)return i(this,b)}return dust.log("Section without corresponding key in template `"+b.getTemplateName()+"`",DEBUG),this},Chunk.prototype.exists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(e)return e(this,b)}else{if(d)return d(this,b);dust.log("No block for exists check in template `"+b.getTemplateName()+"`",DEBUG)}return this},Chunk.prototype.notexists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(d)return d(this,b);dust.log("No block for not-exists check in template `"+b.getTemplateName()+"`",DEBUG)}else if(e)return e(this,b);return this},Chunk.prototype.block=function(a,b,c){var d=a||c.block;return d?d(this,b):this},Chunk.prototype.partial=function(a,b,c,d){var e;return void 0===d&&(d=c,c=b),dust.isEmptyObject(d)||(c=c.clone(),e=c.pop(),c=c.push(d).push(e)),dust.isTemplateFn(a)?this.capture(a,b,function(a,b){c.templateName=a,load(a,b,c).end()}):(c.templateName=a,load(a,this,c))},Chunk.prototype.helper=function(a,b,c,d,e){var f,g=this,h=d.filters;if(void 0===e&&(e="h"),!dust.helpers[a])return dust.log("Helper `"+a+"` does not exist",WARN),g;try{return f=dust.helpers[a](g,b,c,d),f instanceof Chunk?f:("string"==typeof h&&(h=h.split("|")),dust.isEmptyObject(c)?g.reference(f,b,e,h):g.section(f,b,c,d))}catch(i){return dust.log("Error in helper `"+a+"`: "+i.message,ERROR),g.setError(i)}},Chunk.prototype.await=function(a,b,c,d,e){return this.map(function(f){a.then(function(a){f=c?f.section(a,b,c):f.reference(a,b,d,e),f.end()},function(a){var d=c&&c.error;d?f.render(d,b.push(a)).end():(dust.log("Unhandled promise rejection in `"+b.getTemplateName()+"`",INFO),f.end())})})},Chunk.prototype.stream=function(a,b,c,d,e){var f=c&&c.block,g=c&&c.error;return this.map(function(h){var i=!1;a.on("data",function(a){i||(f?h=h.map(function(c){c.render(f,b.push(a)).end()}):c||(h=h.reference(a,b,d,e)))}).on("error",function(a){i||(g?h.render(g,b.push(a)):dust.log("Unhandled stream error in `"+b.getTemplateName()+"`",INFO),i||(i=!0,h.end()))}).on("end",function(){i||(i=!0,h.end())})})},Chunk.prototype.capture=function(a,b,c){return this.map(function(d){var e=new Stub(function(a,b){a?d.setError(a):c(b,d)});a(e.head,b).end()})},Chunk.prototype.setError=function(a){return this.error=a,this.root.flush(),this};for(var f in Chunk.prototype)dust._aliases[f]&&(Chunk.prototype[dust._aliases[f]]=Chunk.prototype[f]);Tap.prototype.push=function(a){return new Tap(a,this)},Tap.prototype.go=function(a){for(var b=this;b;)a=b.head(a),b=b.tail;return a};var HCHARS=/[&<>"']/,AMP=/&/g,LT=//g,QUOT=/\"/g,SQUOT=/\'/g;dust.escapeHtml=function(a){return"string"==typeof a||a&&"function"==typeof a.toString?("string"!=typeof a&&(a=a.toString()),HCHARS.test(a)?a.replace(AMP,"&").replace(LT,"<").replace(GT,">").replace(QUOT,""").replace(SQUOT,"'"):a):a};var BS=/\\/g,FS=/\//g,CR=/\r/g,LS=/\u2028/g,PS=/\u2029/g,NL=/\n/g,LF=/\f/g,SQ=/'/g,DQ=/"/g,TB=/\t/g;return dust.escapeJs=function(a){return"string"==typeof a?a.replace(BS,"\\\\").replace(FS,"\\/").replace(DQ,'\\"').replace(SQ,"\\'").replace(CR,"\\r").replace(LS,"\\u2028").replace(PS,"\\u2029").replace(NL,"\\n").replace(LF,"\\f").replace(TB,"\\t"):a},dust.escapeJSON=function(a){return JSON?JSON.stringify(a).replace(LS,"\\u2028").replace(PS,"\\u2029").replace(LT,"\\u003c"):(dust.log("JSON is undefined; could not escape `"+a+"`",WARN),a)},dust}),"function"==typeof define&&define.amd&&define.amd.dust===!0&&define(["require","dust.core"],function(require,dust){return dust.onLoad=function(a,b){require([a],function(){b()})},dust}); \ No newline at end of file +!function(a,b){"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.core",[],b):"object"==typeof exports?module.exports=b():a.dust=b()}(this,function(){function getTemplate(a,b){return a?"function"==typeof a&&a.template?a.template:dust.isTemplateFn(a)?a:b!==!1?dust.cache[a]:void 0:void 0}function load(a,b,c){if(!a)return b.setError(new Error("No template or template name provided to render"));var d=getTemplate(a,dust.config.cache);return d?d(b,Context.wrap(c,d.templateName)):dust.onLoad?b.map(function(b){function d(a,d){var f;if(a)return b.setError(a);if(f=getTemplate(d,!1)||getTemplate(e,dust.config.cache),!f){if(!dust.compile)return b.setError(new Error("Dust compiler not available"));f=dust.loadSource(dust.compile(d,e))}f(b,Context.wrap(c,f.templateName)).end()}var e=a;3===dust.onLoad.length?dust.onLoad(e,c.options,d):dust.onLoad(e,d)}):b.setError(new Error("Template Not Found: "+a))}function Context(a,b,c,d,e){void 0===a||a instanceof Stack||(a=new Stack(a)),this.stack=a,this.global=b,this.options=c,this.blocks=d,this.templateName=e,this._isContext=!0}function getWithResolvedData(a,b,c){return function(d){return a.push(d)._get(b,c)}}function Stack(a,b,c,d){this.tail=b,this.isObject=a&&"object"==typeof a,this.head=a,this.index=c,this.of=d}function Stub(a){this.head=new Chunk(this),this.callback=a,this.out=""}function Stream(){this.head=new Chunk(this)}function Chunk(a,b,c){this.root=a,this.next=b,this.data=[],this.flushable=!1,this.taps=c}function Tap(a,b){this.head=a,this.tail=b}var dust={version:"2.7.4"},NONE="NONE",ERROR="ERROR",WARN="WARN",INFO="INFO",DEBUG="DEBUG",EMPTY_FUNC=function(){};dust.config={whitespace:!1,amd:!1,cjs:!1,cache:!0},dust._aliases={write:"w",end:"e",map:"m",render:"r",reference:"f",section:"s",exists:"x",notexists:"nx",block:"b",partial:"p",helper:"h"},function(){var a,b,c={DEBUG:0,INFO:1,WARN:2,ERROR:3,NONE:4};"undefined"!=typeof console&&console.log?(a=console.log,b="function"==typeof a?function(){a.apply(console,arguments)}:function(){a(Array.prototype.slice.apply(arguments).join(" "))}):b=EMPTY_FUNC,dust.log=function(a,d){d=d||INFO,c[d]>=c[dust.debugLevel]&&b("[DUST:"+d+"]",a)},dust.debugLevel=NONE,"undefined"!=typeof process&&process.env&&/\bdust\b/.test(process.env.DEBUG)&&(dust.debugLevel=DEBUG)}(),dust.helpers={},dust.cache={},dust.register=function(a,b){a&&(b.templateName=a,dust.config.cache!==!1&&(dust.cache[a]=b))},dust.render=function(a,b,c){var d=new Stub(c).head;try{load(a,d,b).end()}catch(e){d.setError(e)}},dust.stream=function(a,b){var c=new Stream,d=c.head;return dust.nextTick(function(){try{load(a,d,b).end()}catch(c){d.setError(c)}}),c},dust.loadSource=function(source){return eval(source)},dust.isArray=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},dust.nextTick=function(){return function(a){setTimeout(a,0)}}(),dust.isEmpty=function(a){return 0===a?!1:dust.isArray(a)&&!a.length?!0:!a},dust.isEmptyObject=function(a){var b;if(null===a)return!1;if(void 0===a)return!1;if(a.length>0)return!1;for(b in a)if(Object.prototype.hasOwnProperty.call(a,b))return!1;return!0},dust.isTemplateFn=function(a){return"function"==typeof a&&a.__dustBody},dust.isThenable=function(a){return a&&"object"==typeof a&&"function"==typeof a.then},dust.isStreamable=function(a){return a&&"function"==typeof a.on&&"function"==typeof a.pipe},dust.filter=function(a,b,c,d){var e,f,g,h;if(c)for(e=0,f=c.length;f>e;e++)g=c[e],g.length&&(h=dust.filters[g],"s"===g?b=null:"function"==typeof h?a=h(a,d):dust.log("Invalid filter `"+g+"`",WARN));return b&&(a=dust.filters[b](a,d)),a},dust.filters={h:function(a){return dust.escapeHtml(a)},j:function(a){return dust.escapeJs(a)},u:encodeURI,uc:encodeURIComponent,js:function(a){return dust.escapeJSON(a)},jp:function(a){return JSON?JSON.parse(a):(dust.log("JSON is undefined; could not parse `"+a+"`",WARN),a)}},dust.makeBase=dust.context=function(a,b){return new Context(void 0,a,b)},dust.isContext=function(a){return"object"==typeof a&&a._isContext===!0},Context.wrap=function(a,b){return dust.isContext(a)?a:new Context(a,{},{},null,b)},Context.prototype.get=function(a,b){return"string"==typeof a&&("."===a[0]&&(b=!0,a=a.substr(1)),a=a.split(".")),this._get(b,a)},Context.prototype._get=function(a,b){var c,d,e,f,g,h=this.stack||{},i=1;if(d=b[0],e=b.length,a&&0===e)f=h,h=h.head;else{if(a)h&&(h=h.head?h.head[d]:void 0);else{for(;h&&(!h.isObject||(f=h.head,c=h.head[d],void 0===c));)h=h.tail;h=void 0!==c?c:this.global&&this.global[d]}for(;h&&e>i;){if(dust.isThenable(h))return h.then(getWithResolvedData(this,a,b.slice(i)));f=h,h=h[b[i]],i++}}return"function"==typeof h?(g=function(){try{return h.apply(f,arguments)}catch(a){throw dust.log(a,ERROR),a}},g.__dustBody=!!h.__dustBody,g):(void 0===h&&dust.log("Cannot find reference `{"+b.join(".")+"}` in template `"+this.getTemplateName()+"`",INFO),h)},Context.prototype.getPath=function(a,b){return this._get(a,b)},Context.prototype.push=function(a,b,c){return void 0===a?(dust.log("Not pushing an undefined variable onto the context",INFO),this):this.rebase(new Stack(a,this.stack,b,c))},Context.prototype.pop=function(){var a=this.current();return this.stack=this.stack&&this.stack.tail,a},Context.prototype.rebase=function(a){return new Context(a,this.global,this.options,this.blocks,this.getTemplateName())},Context.prototype.clone=function(){var a=this.rebase();return a.stack=this.stack,a},Context.prototype.current=function(){return this.stack&&this.stack.head},Context.prototype.getBlock=function(a){var b,c,d;if("function"==typeof a&&(a=a(new Chunk,this).data.join("")),b=this.blocks,!b)return dust.log("No blocks for context `"+a+"` in template `"+this.getTemplateName()+"`",DEBUG),!1;for(c=b.length;c--;)if(d=b[c][a])return d;return dust.log("Malformed template `"+this.getTemplateName()+"` was missing one or more blocks."),!1},Context.prototype.shiftBlocks=function(a){var b,c=this.blocks;return a?(b=c?c.concat([a]):[a],new Context(this.stack,this.global,this.options,b,this.getTemplateName())):this},Context.prototype.resolve=function(a){var b;return"function"!=typeof a?a:(b=(new Chunk).render(a,this),b instanceof Chunk?b.data.join(""):b)},Context.prototype.getTemplateName=function(){return this.templateName},Stub.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.callback(a.error),dust.log("Rendering failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.out+=a.data.join(""),a=a.next,this.head=a}this.callback(null,this.out)},Stream.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.emit("error",a.error),this.emit("end"),dust.log("Streaming failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.emit("data",a.data.join("")),a=a.next,this.head=a}this.emit("end")},Stream.prototype.emit=function(a,b){var c,d,e=this.events||{},f=e[a]||[];if(!f.length)return dust.log("Stream broadcasting, but no listeners for `"+a+"`",DEBUG),!1;for(f=f.slice(0),c=0,d=f.length;d>c;c++)f[c](b);return!0},Stream.prototype.on=function(a,b){var c=this.events=this.events||{},d=c[a]=c[a]||[];return"function"!=typeof b?dust.log("No callback function provided for `"+a+"` event listener",WARN):d.push(b),this},Stream.prototype.pipe=function(a){if("function"!=typeof a.write||"function"!=typeof a.end)return dust.log("Incompatible stream passed to `pipe`",WARN),this;var b=!1;return"function"==typeof a.emit&&a.emit("pipe",this),"function"==typeof a.on&&a.on("error",function(){b=!0}),this.on("data",function(c){if(!b)try{a.write(c,"utf8")}catch(d){dust.log(d,ERROR)}}).on("end",function(){if(!b)try{a.end(),b=!0}catch(c){dust.log(c,ERROR)}})},Chunk.prototype.write=function(a){var b=this.taps;return b&&(a=b.go(a)),this.data.push(a),this},Chunk.prototype.end=function(a){return a&&this.write(a),this.flushable=!0,this.root.flush(),this},Chunk.prototype.map=function(a){var b=new Chunk(this.root,this.next,this.taps),c=new Chunk(this.root,b,this.taps);this.next=c,this.flushable=!0;try{a(c)}catch(d){dust.log(d,ERROR),c.setError(d)}return b},Chunk.prototype.tap=function(a){var b=this.taps;return this.taps=b?b.push(a):new Tap(a),this},Chunk.prototype.untap=function(){return this.taps=this.taps.tail,this},Chunk.prototype.render=function(a,b){return a(this,b)},Chunk.prototype.reference=function(a,b,c,d){return"function"==typeof a?(a=a.apply(b.current(),[this,b,null,{auto:c,filters:d}]),a instanceof Chunk?a:this.reference(a,b,c,d)):dust.isThenable(a)?this.await(a,b,null,c,d):dust.isStreamable(a)?this.stream(a,b,null,c,d):dust.isEmpty(a)?this:this.write(dust.filter(a,c,d,b))},Chunk.prototype.section=function(a,b,c,d){var e,f,g,h=c.block,i=c["else"],j=this;if("function"==typeof a&&!dust.isTemplateFn(a)){try{a=a.apply(b.current(),[this,b,c,d])}catch(k){return dust.log(k,ERROR),this.setError(k)}if(a instanceof Chunk)return a}if(dust.isEmptyObject(c))return j;if(dust.isEmptyObject(d)||(b=b.push(d)),dust.isArray(a)){if(h){if(f=a.length,f>0){for(g=b.stack&&b.stack.head||{},g.$len=f,e=0;f>e;e++)g.$idx=e,j=h(j,b.push(a[e],e,f));return g.$idx=void 0,g.$len=void 0,j}if(i)return i(this,b)}}else{if(dust.isThenable(a))return this.await(a,b,c);if(dust.isStreamable(a))return this.stream(a,b,c);if(a===!0){if(h)return h(this,b)}else if(a||0===a){if(h)return h(this,b.push(a))}else if(i)return i(this,b)}return dust.log("Section without corresponding key in template `"+b.getTemplateName()+"`",DEBUG),this},Chunk.prototype.exists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(e)return e(this,b)}else{if(d)return d(this,b);dust.log("No block for exists check in template `"+b.getTemplateName()+"`",DEBUG)}return this},Chunk.prototype.notexists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(d)return d(this,b);dust.log("No block for not-exists check in template `"+b.getTemplateName()+"`",DEBUG)}else if(e)return e(this,b);return this},Chunk.prototype.block=function(a,b,c){var d=a||c.block;return d?d(this,b):this},Chunk.prototype.partial=function(a,b,c,d){var e;return void 0===d&&(d=c,c=b),dust.isEmptyObject(d)||(c=c.clone(),e=c.pop(),c=c.push(d).push(e)),dust.isTemplateFn(a)?this.capture(a,b,function(a,b){c.templateName=a,load(a,b,c).end()}):(c.templateName=a,load(a,this,c))},Chunk.prototype.helper=function(a,b,c,d,e){var f,g=this,h=d.filters;if(void 0===e&&(e="h"),!dust.helpers[a])return dust.log("Helper `"+a+"` does not exist",WARN),g;try{return f=dust.helpers[a](g,b,c,d),f instanceof Chunk?f:("string"==typeof h&&(h=h.split("|")),dust.isEmptyObject(c)?g.reference(f,b,e,h):g.section(f,b,c,d))}catch(i){return dust.log("Error in helper `"+a+"`: "+i.message,ERROR),g.setError(i)}},Chunk.prototype.await=function(a,b,c,d,e){return this.map(function(f){a.then(function(a){f=c?f.section(a,b,c):f.reference(a,b,d,e),f.end()},function(a){var d=c&&c.error;d?f.render(d,b.push(a)).end():(dust.log("Unhandled promise rejection in `"+b.getTemplateName()+"`",INFO),f.end())})})},Chunk.prototype.stream=function(a,b,c,d,e){var f=c&&c.block,g=c&&c.error;return this.map(function(h){var i=!1;a.on("data",function(a){i||(f?h=h.map(function(c){c.render(f,b.push(a)).end()}):c||(h=h.reference(a,b,d,e)))}).on("error",function(a){i||(g?h.render(g,b.push(a)):dust.log("Unhandled stream error in `"+b.getTemplateName()+"`",INFO),i||(i=!0,h.end()))}).on("end",function(){i||(i=!0,h.end())})})},Chunk.prototype.capture=function(a,b,c){return this.map(function(d){var e=new Stub(function(a,b){a?d.setError(a):c(b,d)});a(e.head,b).end()})},Chunk.prototype.setError=function(a){return this.error=a,this.root.flush(),this};for(var f in Chunk.prototype)dust._aliases[f]&&(Chunk.prototype[dust._aliases[f]]=Chunk.prototype[f]);Tap.prototype.push=function(a){return new Tap(a,this)},Tap.prototype.go=function(a){for(var b=this;b;)a=b.head(a),b=b.tail;return a};var HCHARS=/[&<>"']/,AMP=/&/g,LT=//g,QUOT=/\"/g,SQUOT=/\'/g;dust.escapeHtml=function(a){return"string"==typeof a||a&&"function"==typeof a.toString?("string"!=typeof a&&(a=a.toString()),HCHARS.test(a)?a.replace(AMP,"&").replace(LT,"<").replace(GT,">").replace(QUOT,""").replace(SQUOT,"'"):a):a};var BS=/\\/g,FS=/\//g,CR=/\r/g,LS=/\u2028/g,PS=/\u2029/g,NL=/\n/g,LF=/\f/g,SQ=/'/g,DQ=/"/g,TB=/\t/g;return dust.escapeJs=function(a){return"string"==typeof a?a.replace(BS,"\\\\").replace(FS,"\\/").replace(DQ,'\\"').replace(SQ,"\\'").replace(CR,"\\r").replace(LS,"\\u2028").replace(PS,"\\u2029").replace(NL,"\\n").replace(LF,"\\f").replace(TB,"\\t"):a},dust.escapeJSON=function(a){return JSON?JSON.stringify(a).replace(LS,"\\u2028").replace(PS,"\\u2029").replace(LT,"\\u003c"):(dust.log("JSON is undefined; could not escape `"+a+"`",WARN),a)},dust}),"function"==typeof define&&define.amd&&define.amd.dust===!0&&define(["require","dust.core"],function(require,dust){return dust.onLoad=function(a,b){require([a],function(){b()})},dust}); \ No newline at end of file diff --git a/dist/dust-full.js b/dist/dust-full.js index 39728935..5413e6ab 100644 --- a/dist/dust-full.js +++ b/dist/dust-full.js @@ -1,4 +1,4 @@ -/*! dustjs-linkedin - v2.7.3 +/*! dustjs-linkedin - v2.7.4 * http://dustjs.com/ * Copyright (c) 2016 Aleksander Williams; Released under the MIT License */ (function (root, factory) { @@ -11,7 +11,7 @@ } }(this, function() { var dust = { - "version": "2.7.3" + "version": "2.7.4" }, NONE = 'NONE', ERROR = 'ERROR', WARN = 'WARN', INFO = 'INFO', DEBUG = 'DEBUG', EMPTY_FUNC = function() {}; @@ -319,12 +319,17 @@ this.options = options; this.blocks = blocks; this.templateName = templateName; + this._isContext = true; } dust.makeBase = dust.context = function(global, options) { return new Context(undefined, global, options); }; + dust.isContext = function(obj) { + return typeof obj === "object" && obj._isContext === true; + }; + /** * Factory function that creates a closure scope around a Thenable-callback. * Returns a function that can be passed to a Thenable that will resume a @@ -338,7 +343,7 @@ } Context.wrap = function(context, name) { - if (context instanceof Context) { + if (dust.isContext(context)) { return context; } return new Context(context, {}, {}, null, name); diff --git a/dist/dust-full.min.js b/dist/dust-full.min.js index 53ac6618..3d82df5f 100644 --- a/dist/dust-full.min.js +++ b/dist/dust-full.min.js @@ -1,5 +1,5 @@ -/*! dustjs-linkedin - v2.7.3 +/*! dustjs-linkedin - v2.7.4 * http://dustjs.com/ * Copyright (c) 2016 Aleksander Williams; Released under the MIT License */ -!function(a,b){"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.core",[],b):"object"==typeof exports?module.exports=b():a.dust=b()}(this,function(){function getTemplate(a,b){return a?"function"==typeof a&&a.template?a.template:dust.isTemplateFn(a)?a:b!==!1?dust.cache[a]:void 0:void 0}function load(a,b,c){if(!a)return b.setError(new Error("No template or template name provided to render"));var d=getTemplate(a,dust.config.cache);return d?d(b,Context.wrap(c,d.templateName)):dust.onLoad?b.map(function(b){function d(a,d){var f;if(a)return b.setError(a);if(f=getTemplate(d,!1)||getTemplate(e,dust.config.cache),!f){if(!dust.compile)return b.setError(new Error("Dust compiler not available"));f=dust.loadSource(dust.compile(d,e))}f(b,Context.wrap(c,f.templateName)).end()}var e=a;3===dust.onLoad.length?dust.onLoad(e,c.options,d):dust.onLoad(e,d)}):b.setError(new Error("Template Not Found: "+a))}function Context(a,b,c,d,e){void 0===a||a instanceof Stack||(a=new Stack(a)),this.stack=a,this.global=b,this.options=c,this.blocks=d,this.templateName=e}function getWithResolvedData(a,b,c){return function(d){return a.push(d)._get(b,c)}}function Stack(a,b,c,d){this.tail=b,this.isObject=a&&"object"==typeof a,this.head=a,this.index=c,this.of=d}function Stub(a){this.head=new Chunk(this),this.callback=a,this.out=""}function Stream(){this.head=new Chunk(this)}function Chunk(a,b,c){this.root=a,this.next=b,this.data=[],this.flushable=!1,this.taps=c}function Tap(a,b){this.head=a,this.tail=b}var dust={version:"2.7.3"},NONE="NONE",ERROR="ERROR",WARN="WARN",INFO="INFO",DEBUG="DEBUG",EMPTY_FUNC=function(){};dust.config={whitespace:!1,amd:!1,cjs:!1,cache:!0},dust._aliases={write:"w",end:"e",map:"m",render:"r",reference:"f",section:"s",exists:"x",notexists:"nx",block:"b",partial:"p",helper:"h"},function(){var a,b,c={DEBUG:0,INFO:1,WARN:2,ERROR:3,NONE:4};"undefined"!=typeof console&&console.log?(a=console.log,b="function"==typeof a?function(){a.apply(console,arguments)}:function(){a(Array.prototype.slice.apply(arguments).join(" "))}):b=EMPTY_FUNC,dust.log=function(a,d){d=d||INFO,c[d]>=c[dust.debugLevel]&&b("[DUST:"+d+"]",a)},dust.debugLevel=NONE,"undefined"!=typeof process&&process.env&&/\bdust\b/.test(process.env.DEBUG)&&(dust.debugLevel=DEBUG)}(),dust.helpers={},dust.cache={},dust.register=function(a,b){a&&(b.templateName=a,dust.config.cache!==!1&&(dust.cache[a]=b))},dust.render=function(a,b,c){var d=new Stub(c).head;try{load(a,d,b).end()}catch(e){d.setError(e)}},dust.stream=function(a,b){var c=new Stream,d=c.head;return dust.nextTick(function(){try{load(a,d,b).end()}catch(c){d.setError(c)}}),c},dust.loadSource=function(source){return eval(source)},dust.isArray=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},dust.nextTick=function(){return function(a){setTimeout(a,0)}}(),dust.isEmpty=function(a){return 0===a?!1:dust.isArray(a)&&!a.length?!0:!a},dust.isEmptyObject=function(a){var b;if(null===a)return!1;if(void 0===a)return!1;if(a.length>0)return!1;for(b in a)if(Object.prototype.hasOwnProperty.call(a,b))return!1;return!0},dust.isTemplateFn=function(a){return"function"==typeof a&&a.__dustBody},dust.isThenable=function(a){return a&&"object"==typeof a&&"function"==typeof a.then},dust.isStreamable=function(a){return a&&"function"==typeof a.on&&"function"==typeof a.pipe},dust.filter=function(a,b,c,d){var e,f,g,h;if(c)for(e=0,f=c.length;f>e;e++)g=c[e],g.length&&(h=dust.filters[g],"s"===g?b=null:"function"==typeof h?a=h(a,d):dust.log("Invalid filter `"+g+"`",WARN));return b&&(a=dust.filters[b](a,d)),a},dust.filters={h:function(a){return dust.escapeHtml(a)},j:function(a){return dust.escapeJs(a)},u:encodeURI,uc:encodeURIComponent,js:function(a){return dust.escapeJSON(a)},jp:function(a){return JSON?JSON.parse(a):(dust.log("JSON is undefined; could not parse `"+a+"`",WARN),a)}},dust.makeBase=dust.context=function(a,b){return new Context(void 0,a,b)},Context.wrap=function(a,b){return a instanceof Context?a:new Context(a,{},{},null,b)},Context.prototype.get=function(a,b){return"string"==typeof a&&("."===a[0]&&(b=!0,a=a.substr(1)),a=a.split(".")),this._get(b,a)},Context.prototype._get=function(a,b){var c,d,e,f,g,h=this.stack||{},i=1;if(d=b[0],e=b.length,a&&0===e)f=h,h=h.head;else{if(a)h&&(h=h.head?h.head[d]:void 0);else{for(;h&&(!h.isObject||(f=h.head,c=h.head[d],void 0===c));)h=h.tail;h=void 0!==c?c:this.global&&this.global[d]}for(;h&&e>i;){if(dust.isThenable(h))return h.then(getWithResolvedData(this,a,b.slice(i)));f=h,h=h[b[i]],i++}}return"function"==typeof h?(g=function(){try{return h.apply(f,arguments)}catch(a){throw dust.log(a,ERROR),a}},g.__dustBody=!!h.__dustBody,g):(void 0===h&&dust.log("Cannot find reference `{"+b.join(".")+"}` in template `"+this.getTemplateName()+"`",INFO),h)},Context.prototype.getPath=function(a,b){return this._get(a,b)},Context.prototype.push=function(a,b,c){return void 0===a?(dust.log("Not pushing an undefined variable onto the context",INFO),this):this.rebase(new Stack(a,this.stack,b,c))},Context.prototype.pop=function(){var a=this.current();return this.stack=this.stack&&this.stack.tail,a},Context.prototype.rebase=function(a){return new Context(a,this.global,this.options,this.blocks,this.getTemplateName())},Context.prototype.clone=function(){var a=this.rebase();return a.stack=this.stack,a},Context.prototype.current=function(){return this.stack&&this.stack.head},Context.prototype.getBlock=function(a){var b,c,d;if("function"==typeof a&&(a=a(new Chunk,this).data.join("")),b=this.blocks,!b)return dust.log("No blocks for context `"+a+"` in template `"+this.getTemplateName()+"`",DEBUG),!1;for(c=b.length;c--;)if(d=b[c][a])return d;return dust.log("Malformed template `"+this.getTemplateName()+"` was missing one or more blocks."),!1},Context.prototype.shiftBlocks=function(a){var b,c=this.blocks;return a?(b=c?c.concat([a]):[a],new Context(this.stack,this.global,this.options,b,this.getTemplateName())):this},Context.prototype.resolve=function(a){var b;return"function"!=typeof a?a:(b=(new Chunk).render(a,this),b instanceof Chunk?b.data.join(""):b)},Context.prototype.getTemplateName=function(){return this.templateName},Stub.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.callback(a.error),dust.log("Rendering failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.out+=a.data.join(""),a=a.next,this.head=a}this.callback(null,this.out)},Stream.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.emit("error",a.error),this.emit("end"),dust.log("Streaming failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.emit("data",a.data.join("")),a=a.next,this.head=a}this.emit("end")},Stream.prototype.emit=function(a,b){var c,d,e=this.events||{},f=e[a]||[];if(!f.length)return dust.log("Stream broadcasting, but no listeners for `"+a+"`",DEBUG),!1;for(f=f.slice(0),c=0,d=f.length;d>c;c++)f[c](b);return!0},Stream.prototype.on=function(a,b){var c=this.events=this.events||{},d=c[a]=c[a]||[];return"function"!=typeof b?dust.log("No callback function provided for `"+a+"` event listener",WARN):d.push(b),this},Stream.prototype.pipe=function(a){if("function"!=typeof a.write||"function"!=typeof a.end)return dust.log("Incompatible stream passed to `pipe`",WARN),this;var b=!1;return"function"==typeof a.emit&&a.emit("pipe",this),"function"==typeof a.on&&a.on("error",function(){b=!0}),this.on("data",function(c){if(!b)try{a.write(c,"utf8")}catch(d){dust.log(d,ERROR)}}).on("end",function(){if(!b)try{a.end(),b=!0}catch(c){dust.log(c,ERROR)}})},Chunk.prototype.write=function(a){var b=this.taps;return b&&(a=b.go(a)),this.data.push(a),this},Chunk.prototype.end=function(a){return a&&this.write(a),this.flushable=!0,this.root.flush(),this},Chunk.prototype.map=function(a){var b=new Chunk(this.root,this.next,this.taps),c=new Chunk(this.root,b,this.taps);this.next=c,this.flushable=!0;try{a(c)}catch(d){dust.log(d,ERROR),c.setError(d)}return b},Chunk.prototype.tap=function(a){var b=this.taps;return this.taps=b?b.push(a):new Tap(a),this},Chunk.prototype.untap=function(){return this.taps=this.taps.tail,this},Chunk.prototype.render=function(a,b){return a(this,b)},Chunk.prototype.reference=function(a,b,c,d){return"function"==typeof a?(a=a.apply(b.current(),[this,b,null,{auto:c,filters:d}]),a instanceof Chunk?a:this.reference(a,b,c,d)):dust.isThenable(a)?this.await(a,b,null,c,d):dust.isStreamable(a)?this.stream(a,b,null,c,d):dust.isEmpty(a)?this:this.write(dust.filter(a,c,d,b))},Chunk.prototype.section=function(a,b,c,d){var e,f,g,h=c.block,i=c["else"],j=this;if("function"==typeof a&&!dust.isTemplateFn(a)){try{a=a.apply(b.current(),[this,b,c,d])}catch(k){return dust.log(k,ERROR),this.setError(k)}if(a instanceof Chunk)return a}if(dust.isEmptyObject(c))return j;if(dust.isEmptyObject(d)||(b=b.push(d)),dust.isArray(a)){if(h){if(f=a.length,f>0){for(g=b.stack&&b.stack.head||{},g.$len=f,e=0;f>e;e++)g.$idx=e,j=h(j,b.push(a[e],e,f));return g.$idx=void 0,g.$len=void 0,j}if(i)return i(this,b)}}else{if(dust.isThenable(a))return this.await(a,b,c);if(dust.isStreamable(a))return this.stream(a,b,c);if(a===!0){if(h)return h(this,b)}else if(a||0===a){if(h)return h(this,b.push(a))}else if(i)return i(this,b)}return dust.log("Section without corresponding key in template `"+b.getTemplateName()+"`",DEBUG),this},Chunk.prototype.exists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(e)return e(this,b)}else{if(d)return d(this,b);dust.log("No block for exists check in template `"+b.getTemplateName()+"`",DEBUG)}return this},Chunk.prototype.notexists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(d)return d(this,b);dust.log("No block for not-exists check in template `"+b.getTemplateName()+"`",DEBUG)}else if(e)return e(this,b);return this},Chunk.prototype.block=function(a,b,c){var d=a||c.block;return d?d(this,b):this},Chunk.prototype.partial=function(a,b,c,d){var e;return void 0===d&&(d=c,c=b),dust.isEmptyObject(d)||(c=c.clone(),e=c.pop(),c=c.push(d).push(e)),dust.isTemplateFn(a)?this.capture(a,b,function(a,b){c.templateName=a,load(a,b,c).end()}):(c.templateName=a,load(a,this,c))},Chunk.prototype.helper=function(a,b,c,d,e){var f,g=this,h=d.filters;if(void 0===e&&(e="h"),!dust.helpers[a])return dust.log("Helper `"+a+"` does not exist",WARN),g;try{return f=dust.helpers[a](g,b,c,d),f instanceof Chunk?f:("string"==typeof h&&(h=h.split("|")),dust.isEmptyObject(c)?g.reference(f,b,e,h):g.section(f,b,c,d))}catch(i){return dust.log("Error in helper `"+a+"`: "+i.message,ERROR),g.setError(i)}},Chunk.prototype.await=function(a,b,c,d,e){return this.map(function(f){a.then(function(a){f=c?f.section(a,b,c):f.reference(a,b,d,e),f.end()},function(a){var d=c&&c.error;d?f.render(d,b.push(a)).end():(dust.log("Unhandled promise rejection in `"+b.getTemplateName()+"`",INFO),f.end())})})},Chunk.prototype.stream=function(a,b,c,d,e){var f=c&&c.block,g=c&&c.error;return this.map(function(h){var i=!1;a.on("data",function(a){i||(f?h=h.map(function(c){c.render(f,b.push(a)).end()}):c||(h=h.reference(a,b,d,e)))}).on("error",function(a){i||(g?h.render(g,b.push(a)):dust.log("Unhandled stream error in `"+b.getTemplateName()+"`",INFO),i||(i=!0,h.end()))}).on("end",function(){i||(i=!0,h.end())})})},Chunk.prototype.capture=function(a,b,c){return this.map(function(d){var e=new Stub(function(a,b){a?d.setError(a):c(b,d)});a(e.head,b).end()})},Chunk.prototype.setError=function(a){return this.error=a,this.root.flush(),this};for(var f in Chunk.prototype)dust._aliases[f]&&(Chunk.prototype[dust._aliases[f]]=Chunk.prototype[f]);Tap.prototype.push=function(a){return new Tap(a,this)},Tap.prototype.go=function(a){for(var b=this;b;)a=b.head(a),b=b.tail;return a};var HCHARS=/[&<>"']/,AMP=/&/g,LT=//g,QUOT=/\"/g,SQUOT=/\'/g;dust.escapeHtml=function(a){return"string"==typeof a||a&&"function"==typeof a.toString?("string"!=typeof a&&(a=a.toString()),HCHARS.test(a)?a.replace(AMP,"&").replace(LT,"<").replace(GT,">").replace(QUOT,""").replace(SQUOT,"'"):a):a};var BS=/\\/g,FS=/\//g,CR=/\r/g,LS=/\u2028/g,PS=/\u2029/g,NL=/\n/g,LF=/\f/g,SQ=/'/g,DQ=/"/g,TB=/\t/g;return dust.escapeJs=function(a){return"string"==typeof a?a.replace(BS,"\\\\").replace(FS,"\\/").replace(DQ,'\\"').replace(SQ,"\\'").replace(CR,"\\r").replace(LS,"\\u2028").replace(PS,"\\u2029").replace(NL,"\\n").replace(LF,"\\f").replace(TB,"\\t"):a},dust.escapeJSON=function(a){return JSON?JSON.stringify(a).replace(LS,"\\u2028").replace(PS,"\\u2029").replace(LT,"\\u003c"):(dust.log("JSON is undefined; could not escape `"+a+"`",WARN),a)},dust}),function(a,b){"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.parse",["dust.core"],function(dust){return b(dust).parse}):"object"==typeof exports?module.exports=b(require("./dust")):b(a.dust)}(this,function(dust){var a=function(){function a(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}function b(a,b,c,d,e,f){this.message=a,this.expected=b,this.found=c,this.offset=d,this.line=e,this.column=f,this.name="SyntaxError"}function c(a){function c(){return f(wc).line}function d(){return f(wc).column}function e(a){throw h(a,null,wc)}function f(b){function c(b,c,d){var e,f;for(e=c;d>e;e++)f=a.charAt(e),"\n"===f?(b.seenCR||b.line++,b.column=1,b.seenCR=!1):"\r"===f||"\u2028"===f||"\u2029"===f?(b.line++,b.column=1,b.seenCR=!0):(b.column++,b.seenCR=!1)}return xc!==b&&(xc>b&&(xc=0,yc={line:1,column:1,seenCR:!1}),c(yc,xc,b),xc=b),yc}function g(a){zc>vc||(vc>zc&&(zc=vc,Ac=[]),Ac.push(a))}function h(c,d,e){function g(a){var b=1;for(a.sort(function(a,b){return a.descriptionb.description?1:0});b1?g.slice(0,-1).join(", ")+" or "+g[a.length-1]:g[0],e=b?'"'+c(b)+'"':"end of input","Expected "+d+" but "+e+" found."}var i=f(e),j=evc?(j=a.charAt(vc),vc++):(j=X,0===Bc&&g(Eb)),j!==X?(wc=d,e=Fb(j),d=e):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa),d!==X)for(;d!==X;)c.push(d),d=vc,e=vc,Bc++,f=M(),Bc--,f===X?e=da:(vc=e,e=aa),e!==X?(f=vc,Bc++,h=K(),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(h=vc,Bc++,i=L(),Bc--,i===X?h=da:(vc=h,h=aa),h!==X?(i=vc,Bc++,j=R(),Bc--,j===X?i=da:(vc=i,i=aa),i!==X?(a.length>vc?(j=a.charAt(vc),vc++):(j=X,0===Bc&&g(Eb)),j!==X?(wc=d,e=Fb(j),d=e):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa);else c=aa;c!==X&&(wc=b,c=Gb(c)),b=c}return Bc--,b===X&&(c=X,0===Bc&&g(Cb)),b}function I(){var b,c,d,e,f;if(Bc++,b=vc,c=[],d=vc,e=vc,Bc++,f=M(),Bc--,f===X?e=da:(vc=e,e=aa),e!==X?(f=J(),f===X&&(Ib.test(a.charAt(vc))?(f=a.charAt(vc),vc++):(f=X,0===Bc&&g(Jb))),f!==X?(wc=d,e=Fb(f),d=e):(vc=d,d=aa)):(vc=d,d=aa),d!==X)for(;d!==X;)c.push(d),d=vc,e=vc,Bc++,f=M(),Bc--,f===X?e=da:(vc=e,e=aa),e!==X?(f=J(),f===X&&(Ib.test(a.charAt(vc))?(f=a.charAt(vc),vc++):(f=X,0===Bc&&g(Jb))),f!==X?(wc=d,e=Fb(f),d=e):(vc=d,d=aa)):(vc=d,d=aa);else c=aa;return c!==X&&(wc=b,c=Kb(c)),b=c,Bc--,b===X&&(c=X,0===Bc&&g(Hb)),b}function J(){var b,c;return b=vc,a.substr(vc,2)===Lb?(c=Lb,vc+=2):(c=X,0===Bc&&g(Mb)),c!==X&&(wc=b,c=Nb()),b=c}function K(){var b,c,d,e,f,h;if(Bc++,b=vc,a.substr(vc,2)===Pb?(c=Pb,vc+=2):(c=X,0===Bc&&g(Qb)),c!==X){for(d=[],e=vc,f=vc,Bc++,a.substr(vc,2)===Rb?(h=Rb,vc+=2):(h=X,0===Bc&&g(Sb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Tb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);e!==X;)d.push(e),e=vc,f=vc,Bc++,a.substr(vc,2)===Rb?(h=Rb,vc+=2):(h=X,0===Bc&&g(Sb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Tb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);d!==X?(a.substr(vc,2)===Rb?(e=Rb,vc+=2):(e=X,0===Bc&&g(Sb)),e!==X?(wc=b,c=Ub(d),b=c):(vc=b,b=aa)):(vc=b,b=aa)}else vc=b,b=aa;return Bc--,b===X&&(c=X,0===Bc&&g(Ob)),b}function L(){var b,c,d,e,f,h;if(Bc++,b=vc,a.substr(vc,2)===Wb?(c=Wb,vc+=2):(c=X,0===Bc&&g(Xb)),c!==X){for(d=[],e=vc,f=vc,Bc++,a.substr(vc,2)===Yb?(h=Yb,vc+=2):(h=X,0===Bc&&g(Zb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Fb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);e!==X;)d.push(e),e=vc,f=vc,Bc++,a.substr(vc,2)===Yb?(h=Yb,vc+=2):(h=X,0===Bc&&g(Zb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Fb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);d!==X?(a.substr(vc,2)===Yb?(e=Yb,vc+=2):(e=X,0===Bc&&g(Zb)),e!==X?(wc=b,c=$b(d),b=c):(vc=b,b=aa)):(vc=b,b=aa)}else vc=b,b=aa;return Bc--,b===X&&(c=X,0===Bc&&g(Vb)),b}function M(){var b,c,d,e,f,h,i,j,k,l;if(b=vc,c=N(),c!==X){for(d=[],e=S();e!==X;)d.push(e),e=S();if(d!==X)if(_b.test(a.charAt(vc))?(e=a.charAt(vc),vc++):(e=X,0===Bc&&g(ac)),e!==X){for(f=[],h=S();h!==X;)f.push(h),h=S();if(f!==X){if(h=[],i=vc,j=vc,Bc++,k=O(),Bc--,k===X?j=da:(vc=j,j=aa),j!==X?(k=vc,Bc++,l=R(),Bc--,l===X?k=da:(vc=k,k=aa),k!==X?(a.length>vc?(l=a.charAt(vc),vc++):(l=X,0===Bc&&g(Eb)),l!==X?(j=[j,k,l],i=j):(vc=i,i=aa)):(vc=i,i=aa)):(vc=i,i=aa),i!==X)for(;i!==X;)h.push(i),i=vc,j=vc,Bc++,k=O(),Bc--,k===X?j=da:(vc=j,j=aa),j!==X?(k=vc,Bc++,l=R(),Bc--,l===X?k=da:(vc=k,k=aa),k!==X?(a.length>vc?(l=a.charAt(vc),vc++):(l=X,0===Bc&&g(Eb)),l!==X?(j=[j,k,l],i=j):(vc=i,i=aa)):(vc=i,i=aa)):(vc=i,i=aa);else h=aa;if(h!==X){for(i=[],j=S();j!==X;)i.push(j),j=S();i!==X?(j=O(),j!==X?(c=[c,d,e,f,h,i,j],b=c):(vc=b,b=aa)):(vc=b,b=aa)}else vc=b,b=aa}else vc=b,b=aa}else vc=b,b=aa;else vc=b,b=aa}else vc=b,b=aa;return b===X&&(b=r()),b}function N(){var b;return 123===a.charCodeAt(vc)?(b=bc,vc++):(b=X,0===Bc&&g(cc)),b}function O(){var b;return 125===a.charCodeAt(vc)?(b=dc,vc++):(b=X,0===Bc&&g(ec)),b}function P(){var b;return 91===a.charCodeAt(vc)?(b=fc,vc++):(b=X,0===Bc&&g(gc)),b}function Q(){var b;return 93===a.charCodeAt(vc)?(b=hc,vc++):(b=X,0===Bc&&g(ic)),b}function R(){var b;return 10===a.charCodeAt(vc)?(b=jc,vc++):(b=X,0===Bc&&g(kc)),b===X&&(a.substr(vc,2)===lc?(b=lc,vc+=2):(b=X,0===Bc&&g(mc)),b===X&&(13===a.charCodeAt(vc)?(b=nc,vc++):(b=X,0===Bc&&g(oc)),b===X&&(8232===a.charCodeAt(vc)?(b=pc,vc++):(b=X,0===Bc&&g(qc)),b===X&&(8233===a.charCodeAt(vc)?(b=rc,vc++):(b=X,0===Bc&&g(sc)))))),b}function S(){var b;return tc.test(a.charAt(vc))?(b=a.charAt(vc),vc++):(b=X,0===Bc&&g(uc)),b===X&&(b=R()),b}function T(a){return parseInt(a.join(""),10)}function U(a){return a.concat([["line",c()],["col",d()]])}var V,W=arguments.length>1?arguments[1]:{},X={},Y={start:i},Z=i,$=function(a){var b=["body"].concat(a);return U(b)},_={type:"other",description:"section"},aa=X,ba=null,ca=function(a,b,c,d){return d&&a[1].text===d.text||e("Expected end tag for "+a[1].text+" but it was not found."),!0},da=void 0,ea=function(a,b,c){return c.push(["param",["literal","block"],b]),a.push(c,["filters"]),U(a)},fa="/",ga={type:"literal",value:"/",description:'"/"'},ha=function(a){return a.push(["bodies"],["filters"]),U(a)},ia=/^[#?\^<+@%]/,ja={type:"class",value:"[#?\\^<+@%]",description:"[#?\\^<+@%]"},ka=function(a,b,c,d){return[a,b,c,d]},la={type:"other",description:"end tag"},ma=function(a){return a},na=":",oa={type:"literal",value:":",description:'":"'},pa=function(a){return a},qa=function(a){return a?["context",a]:["context"]},ra={type:"other",description:"params"},sa="=",ta={type:"literal",value:"=",description:'"="'},ua=function(a,b){return["param",["literal",a],b]},va=function(a){return["params"].concat(a)},wa={type:"other",description:"bodies"},xa=function(a){return["bodies"].concat(a)},ya={type:"other",description:"reference"},za=function(a,b){return U(["reference",a,b])},Aa={type:"other",description:"partial"},Ba=">",Ca={type:"literal",value:">",description:'">"'},Da="+",Ea={type:"literal",value:"+",description:'"+"'},Fa=function(a){return["literal",a]},Ga=function(a,b,c,d){var e=">"===a?"partial":a;return U([e,b,c,d])},Ha={type:"other",description:"filters"},Ia="|",Ja={type:"literal",value:"|",description:'"|"'},Ka=function(a){return["filters"].concat(a)},La={type:"other",description:"special"},Ma="~",Na={type:"literal",value:"~",description:'"~"'},Oa=function(a){return U(["special",a])},Pa={type:"other",description:"identifier"},Qa=function(a){var b=["path"].concat(a);return b.text=a[1].join(".").replace(/,line,\d+,col,\d+/g,""),b},Ra=function(a){var b=["key",a];return b.text=a,b},Sa={type:"other",description:"number"},Ta=function(a){return["literal",a]},Ua={type:"other",description:"float"},Va=".",Wa={type:"literal",value:".",description:'"."'},Xa=function(a,b){return parseFloat(a+"."+b)},Ya={type:"other",description:"unsigned_integer"},Za=/^[0-9]/,$a={type:"class",value:"[0-9]",description:"[0-9]"},_a=function(a){return T(a)},ab={type:"other",description:"signed_integer"},bb="-",cb={type:"literal",value:"-",description:'"-"'},db=function(a,b){return-1*b},eb={type:"other",description:"integer"},fb={type:"other",description:"path"},gb=function(a,b){return b=b[0],a&&b?(b.unshift(a),U([!1,b])):U([!0,b])},hb=function(a){return U(a.length>0?[!0,a[0]]:[!0,[]])},ib={type:"other",description:"key"},jb=/^[a-zA-Z_$]/,kb={type:"class",value:"[a-zA-Z_$]",description:"[a-zA-Z_$]"},lb=/^[0-9a-zA-Z_$\-]/,mb={type:"class",value:"[0-9a-zA-Z_$\\-]",description:"[0-9a-zA-Z_$\\-]"},nb=function(a,b){return a+b.join("")},ob={type:"other",description:"array"},pb=function(a){return a.join("")},qb=function(a){return a},rb=function(a,b){return b?b.unshift(a):b=[a],b},sb={type:"other",description:"array_part"},tb=function(a){return a},ub=function(a,b){return b?a.concat(b):a},vb={type:"other",description:"inline"},wb='"',xb={type:"literal",value:'"',description:'"\\""'},yb=function(){return U(["literal",""])},zb=function(a){return U(["literal",a])},Ab=function(a){return U(["body"].concat(a))},Bb=function(a){return["buffer",a]},Cb={type:"other",description:"buffer"},Db=function(a,b){return U(["format",a,b.join("")])},Eb={type:"any",description:"any character"},Fb=function(a){return a},Gb=function(a){return U(["buffer",a.join("")])},Hb={type:"other",description:"literal"},Ib=/^[^"]/,Jb={type:"class",value:'[^"]',description:'[^"]'},Kb=function(a){return a.join("")},Lb='\\"',Mb={type:"literal",value:'\\"',description:'"\\\\\\""'},Nb=function(){return'"'},Ob={type:"other",description:"raw"},Pb="{`",Qb={type:"literal",value:"{`",description:'"{`"'},Rb="`}",Sb={type:"literal",value:"`}",description:'"`}"'},Tb=function(a){return a},Ub=function(a){return U(["raw",a.join("")])},Vb={type:"other",description:"comment"},Wb="{!",Xb={type:"literal",value:"{!",description:'"{!"'},Yb="!}",Zb={type:"literal",value:"!}",description:'"!}"'},$b=function(a){return U(["comment",a.join("")])},_b=/^[#?\^><+%:@\/~%]/,ac={type:"class",value:"[#?\\^><+%:@\\/~%]",description:"[#?\\^><+%:@\\/~%]"},bc="{",cc={type:"literal",value:"{",description:'"{"'},dc="}",ec={type:"literal",value:"}",description:'"}"'},fc="[",gc={type:"literal",value:"[",description:'"["'},hc="]",ic={type:"literal",value:"]",description:'"]"'},jc="\n",kc={type:"literal",value:"\n",description:'"\\n"'},lc="\r\n",mc={type:"literal", -value:"\r\n",description:'"\\r\\n"'},nc="\r",oc={type:"literal",value:"\r",description:'"\\r"'},pc="\u2028",qc={type:"literal",value:"\u2028",description:'"\\u2028"'},rc="\u2029",sc={type:"literal",value:"\u2029",description:'"\\u2029"'},tc=/^[\t\x0B\f \xA0\uFEFF]/,uc={type:"class",value:"[\\t\\x0B\\f \\xA0\\uFEFF]",description:"[\\t\\x0B\\f \\xA0\\uFEFF]"},vc=0,wc=0,xc=0,yc={line:1,column:1,seenCR:!1},zc=0,Ac=[],Bc=0;if("startRule"in W){if(!(W.startRule in Y))throw new Error("Can't start parsing from rule \""+W.startRule+'".');Z=Y[W.startRule]}if(V=Z(),V!==X&&vc===a.length)return V;throw V!==X&&vcc;c++)e=r.filterNode(a,b[c]),e&&f.push(e);return f}function d(a,b){var c,d,e,f,g=[b[0]];for(d=1,e=b.length;e>d;d++)f=r.filterNode(a,b[d]),f&&("buffer"===f[0]||"format"===f[0]?c?(c[0]="buffer"===f[0]?"buffer":c[0],c[1]+=f.slice(1,-2).join("")):(c=f,g.push(f)):(c=null,g.push(f)));return g}function e(a,b){return["buffer",t[b[1]],b[2],b[3]]}function f(a,b){return b}function g(){}function h(a,b){return dust.config.whitespace?(b.splice(1,2,b.slice(1,-2).join("")),b):null}function i(a,b){var c,d={name:b,bodies:[],blocks:{},index:0,auto:"h"},e=dust.escapeJs(b),f=b?'"'+e+'",':"",g="function(dust){",h=r.compileNode(d,a);return b&&(g+='dust.register("'+e+'",'+h+");"),g+=j(d)+k(d)+"return "+h+"}",c="("+g+"(dust));",dust.config.amd?"define("+f+'["dust.core"],'+g+");":dust.config.cjs?"module.exports=function(dust){var tmpl="+c+"var f="+q().toString()+";f.template=tmpl;return f}":c}function j(a){var b,c=[],d=a.blocks;for(b in d)c.push('"'+b+'":'+d[b]);return c.length?(a.blocks="ctx=ctx.shiftBlocks(blocks);","var blocks={"+c.join(",")+"};"):(a.blocks="",a.blocks)}function k(a){var b,c,d=[],e=a.bodies,f=a.blocks;for(b=0,c=e.length;c>b;b++)d[b]="function body_"+b+"(chk,ctx){"+f+"return chk"+e[b]+";}body_"+b+".__dustBody=!0;";return d.join("")}function l(a,b){var c,d,e="";for(c=1,d=b.length;d>c;c++)e+=r.compileNode(a,b[c]);return e}function m(a,b,c){return"."+(dust._aliases[c]||c)+"("+r.compileNode(a,b[1])+","+r.compileNode(a,b[2])+","+r.compileNode(a,b[4])+","+r.compileNode(a,b[3])+")"}function n(a){return a.replace(u,"\\\\").replace(v,'\\"').replace(w,"\\f").replace(x,"\\n").replace(y,"\\r").replace(z,"\\t")}function o(a,b,c){var d=dust.loadSource(dust.compile(a));return q(d)(b,c)}function p(a,b){var c=dust.loadSource(dust.compile(a,b));return q(c)}function q(a){return function(b,c){var d=c?"render":"stream";return dust[d](a,b,c)}}var r={},s=dust.isArray;r.compile=function(c,d){try{var e=b(a(c));return i(e,d)}catch(f){if(!f.line||!f.column)throw f;throw new SyntaxError(f.message+" At line : "+f.line+", column : "+f.column)}},r.filterNode=function(a,b){return r.optimizers[b[0]](a,b)},r.optimizers={body:d,buffer:f,special:e,format:h,reference:c,"#":c,"?":c,"^":c,"<":c,"+":c,"@":c,"%":c,partial:c,context:c,params:c,bodies:c,param:c,filters:f,key:f,path:f,literal:f,raw:f,comment:g,line:g,col:g},r.pragmas={esc:function(a,b,c){var d,e=a.auto;return b||(b="h"),a.auto="s"===b?"":b,d=l(a,c.block),a.auto=e,d}};var t={s:" ",n:"\n",r:"\r",lb:"{",rb:"}"};r.compileNode=function(a,b){return r.nodes[b[0]](a,b)},r.nodes={body:function(a,b){var c=a.index++,d="body_"+c;return a.bodies[c]=l(a,b),d},buffer:function(a,b){return".w("+A(b[1])+")"},format:function(a,b){return".w("+A(b[1])+")"},reference:function(a,b){return".f("+r.compileNode(a,b[1])+",ctx,"+r.compileNode(a,b[2])+")"},"#":function(a,b){return m(a,b,"section")},"?":function(a,b){return m(a,b,"exists")},"^":function(a,b){return m(a,b,"notexists")},"<":function(a,b){for(var c=b[4],d=1,e=c.length;e>d;d++){var f=c[d],g=f[1][1];if("block"===g)return a.blocks[b[1].text]=r.compileNode(a,f[2]),""}return""},"+":function(a,b){return"undefined"==typeof b[1].text&&"undefined"==typeof b[4]?".b(ctx.getBlock("+r.compileNode(a,b[1])+",chk, ctx),"+r.compileNode(a,b[2])+", {},"+r.compileNode(a,b[3])+")":".b(ctx.getBlock("+A(b[1].text)+"),"+r.compileNode(a,b[2])+","+r.compileNode(a,b[4])+","+r.compileNode(a,b[3])+")"},"@":function(a,b){return".h("+A(b[1].text)+","+r.compileNode(a,b[2])+","+r.compileNode(a,b[4])+","+r.compileNode(a,b[3])+","+r.compileNode(a,b[5])+")"},"%":function(a,b){var c,d,e,f,g,h,i,j,k,l=b[1][1];if(!r.pragmas[l])return"";for(c=b[4],d={},j=1,k=c.length;k>j;j++)h=c[j],d[h[1][1]]=h[2];for(e=b[3],f={},j=1,k=e.length;k>j;j++)i=e[j],f[i[1][1]]=i[2][1];return g=b[2][1]?b[2][1].text:null,r.pragmas[l](a,g,d,f)},partial:function(a,b){return".p("+r.compileNode(a,b[1])+",ctx,"+r.compileNode(a,b[2])+","+r.compileNode(a,b[3])+")"},context:function(a,b){return b[1]?"ctx.rebase("+r.compileNode(a,b[1])+")":"ctx"},params:function(a,b){for(var c=[],d=1,e=b.length;e>d;d++)c.push(r.compileNode(a,b[d]));return c.length?"{"+c.join(",")+"}":"{}"},bodies:function(a,b){for(var c=[],d=1,e=b.length;e>d;d++)c.push(r.compileNode(a,b[d]));return"{"+c.join(",")+"}"},param:function(a,b){return r.compileNode(a,b[1])+":"+r.compileNode(a,b[2])},filters:function(a,b){for(var c=[],d=1,e=b.length;e>d;d++){var f=b[d];c.push('"'+f+'"')}return'"'+a.auto+'"'+(c.length?",["+c.join(",")+"]":"")},key:function(a,b){return'ctx.get(["'+b[1]+'"], false)'},path:function(a,b){for(var c=b[1],d=b[2],e=[],f=0,g=d.length;g>f;f++)e.push(s(d[f])?r.compileNode(a,d[f]):'"'+d[f]+'"');return"ctx.getPath("+c+", ["+e.join(",")+"])"},literal:function(a,b){return A(b[1])},raw:function(a,b){return".w("+A(b[1])+")"}};var u=/\\/g,v=/"/g,w=/\f/g,x=/\n/g,y=/\r/g,z=/\t/g,A="undefined"==typeof JSON?function(a){return'"'+n(a)+'"'}:JSON.stringify;return dust.compiler=r,dust.compile=dust.compiler.compile,dust.renderSource=o,dust.compileFn=p,dust.filterNode=r.filterNode,dust.optimizers=r.optimizers,dust.pragmas=r.pragmas,dust.compileNode=r.compileNode,dust.nodes=r.nodes,r}),"function"==typeof define&&define.amd&&define.amd.dust===!0&&define(["require","dust.core","dust.compile"],function(require,dust){return dust.onLoad=function(a,b){require([a],function(){b()})},dust}); \ No newline at end of file +!function(a,b){"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.core",[],b):"object"==typeof exports?module.exports=b():a.dust=b()}(this,function(){function getTemplate(a,b){return a?"function"==typeof a&&a.template?a.template:dust.isTemplateFn(a)?a:b!==!1?dust.cache[a]:void 0:void 0}function load(a,b,c){if(!a)return b.setError(new Error("No template or template name provided to render"));var d=getTemplate(a,dust.config.cache);return d?d(b,Context.wrap(c,d.templateName)):dust.onLoad?b.map(function(b){function d(a,d){var f;if(a)return b.setError(a);if(f=getTemplate(d,!1)||getTemplate(e,dust.config.cache),!f){if(!dust.compile)return b.setError(new Error("Dust compiler not available"));f=dust.loadSource(dust.compile(d,e))}f(b,Context.wrap(c,f.templateName)).end()}var e=a;3===dust.onLoad.length?dust.onLoad(e,c.options,d):dust.onLoad(e,d)}):b.setError(new Error("Template Not Found: "+a))}function Context(a,b,c,d,e){void 0===a||a instanceof Stack||(a=new Stack(a)),this.stack=a,this.global=b,this.options=c,this.blocks=d,this.templateName=e,this._isContext=!0}function getWithResolvedData(a,b,c){return function(d){return a.push(d)._get(b,c)}}function Stack(a,b,c,d){this.tail=b,this.isObject=a&&"object"==typeof a,this.head=a,this.index=c,this.of=d}function Stub(a){this.head=new Chunk(this),this.callback=a,this.out=""}function Stream(){this.head=new Chunk(this)}function Chunk(a,b,c){this.root=a,this.next=b,this.data=[],this.flushable=!1,this.taps=c}function Tap(a,b){this.head=a,this.tail=b}var dust={version:"2.7.4"},NONE="NONE",ERROR="ERROR",WARN="WARN",INFO="INFO",DEBUG="DEBUG",EMPTY_FUNC=function(){};dust.config={whitespace:!1,amd:!1,cjs:!1,cache:!0},dust._aliases={write:"w",end:"e",map:"m",render:"r",reference:"f",section:"s",exists:"x",notexists:"nx",block:"b",partial:"p",helper:"h"},function(){var a,b,c={DEBUG:0,INFO:1,WARN:2,ERROR:3,NONE:4};"undefined"!=typeof console&&console.log?(a=console.log,b="function"==typeof a?function(){a.apply(console,arguments)}:function(){a(Array.prototype.slice.apply(arguments).join(" "))}):b=EMPTY_FUNC,dust.log=function(a,d){d=d||INFO,c[d]>=c[dust.debugLevel]&&b("[DUST:"+d+"]",a)},dust.debugLevel=NONE,"undefined"!=typeof process&&process.env&&/\bdust\b/.test(process.env.DEBUG)&&(dust.debugLevel=DEBUG)}(),dust.helpers={},dust.cache={},dust.register=function(a,b){a&&(b.templateName=a,dust.config.cache!==!1&&(dust.cache[a]=b))},dust.render=function(a,b,c){var d=new Stub(c).head;try{load(a,d,b).end()}catch(e){d.setError(e)}},dust.stream=function(a,b){var c=new Stream,d=c.head;return dust.nextTick(function(){try{load(a,d,b).end()}catch(c){d.setError(c)}}),c},dust.loadSource=function(source){return eval(source)},dust.isArray=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},dust.nextTick=function(){return function(a){setTimeout(a,0)}}(),dust.isEmpty=function(a){return 0===a?!1:dust.isArray(a)&&!a.length?!0:!a},dust.isEmptyObject=function(a){var b;if(null===a)return!1;if(void 0===a)return!1;if(a.length>0)return!1;for(b in a)if(Object.prototype.hasOwnProperty.call(a,b))return!1;return!0},dust.isTemplateFn=function(a){return"function"==typeof a&&a.__dustBody},dust.isThenable=function(a){return a&&"object"==typeof a&&"function"==typeof a.then},dust.isStreamable=function(a){return a&&"function"==typeof a.on&&"function"==typeof a.pipe},dust.filter=function(a,b,c,d){var e,f,g,h;if(c)for(e=0,f=c.length;f>e;e++)g=c[e],g.length&&(h=dust.filters[g],"s"===g?b=null:"function"==typeof h?a=h(a,d):dust.log("Invalid filter `"+g+"`",WARN));return b&&(a=dust.filters[b](a,d)),a},dust.filters={h:function(a){return dust.escapeHtml(a)},j:function(a){return dust.escapeJs(a)},u:encodeURI,uc:encodeURIComponent,js:function(a){return dust.escapeJSON(a)},jp:function(a){return JSON?JSON.parse(a):(dust.log("JSON is undefined; could not parse `"+a+"`",WARN),a)}},dust.makeBase=dust.context=function(a,b){return new Context(void 0,a,b)},dust.isContext=function(a){return"object"==typeof a&&a._isContext===!0},Context.wrap=function(a,b){return dust.isContext(a)?a:new Context(a,{},{},null,b)},Context.prototype.get=function(a,b){return"string"==typeof a&&("."===a[0]&&(b=!0,a=a.substr(1)),a=a.split(".")),this._get(b,a)},Context.prototype._get=function(a,b){var c,d,e,f,g,h=this.stack||{},i=1;if(d=b[0],e=b.length,a&&0===e)f=h,h=h.head;else{if(a)h&&(h=h.head?h.head[d]:void 0);else{for(;h&&(!h.isObject||(f=h.head,c=h.head[d],void 0===c));)h=h.tail;h=void 0!==c?c:this.global&&this.global[d]}for(;h&&e>i;){if(dust.isThenable(h))return h.then(getWithResolvedData(this,a,b.slice(i)));f=h,h=h[b[i]],i++}}return"function"==typeof h?(g=function(){try{return h.apply(f,arguments)}catch(a){throw dust.log(a,ERROR),a}},g.__dustBody=!!h.__dustBody,g):(void 0===h&&dust.log("Cannot find reference `{"+b.join(".")+"}` in template `"+this.getTemplateName()+"`",INFO),h)},Context.prototype.getPath=function(a,b){return this._get(a,b)},Context.prototype.push=function(a,b,c){return void 0===a?(dust.log("Not pushing an undefined variable onto the context",INFO),this):this.rebase(new Stack(a,this.stack,b,c))},Context.prototype.pop=function(){var a=this.current();return this.stack=this.stack&&this.stack.tail,a},Context.prototype.rebase=function(a){return new Context(a,this.global,this.options,this.blocks,this.getTemplateName())},Context.prototype.clone=function(){var a=this.rebase();return a.stack=this.stack,a},Context.prototype.current=function(){return this.stack&&this.stack.head},Context.prototype.getBlock=function(a){var b,c,d;if("function"==typeof a&&(a=a(new Chunk,this).data.join("")),b=this.blocks,!b)return dust.log("No blocks for context `"+a+"` in template `"+this.getTemplateName()+"`",DEBUG),!1;for(c=b.length;c--;)if(d=b[c][a])return d;return dust.log("Malformed template `"+this.getTemplateName()+"` was missing one or more blocks."),!1},Context.prototype.shiftBlocks=function(a){var b,c=this.blocks;return a?(b=c?c.concat([a]):[a],new Context(this.stack,this.global,this.options,b,this.getTemplateName())):this},Context.prototype.resolve=function(a){var b;return"function"!=typeof a?a:(b=(new Chunk).render(a,this),b instanceof Chunk?b.data.join(""):b)},Context.prototype.getTemplateName=function(){return this.templateName},Stub.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.callback(a.error),dust.log("Rendering failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.out+=a.data.join(""),a=a.next,this.head=a}this.callback(null,this.out)},Stream.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.emit("error",a.error),this.emit("end"),dust.log("Streaming failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.emit("data",a.data.join("")),a=a.next,this.head=a}this.emit("end")},Stream.prototype.emit=function(a,b){var c,d,e=this.events||{},f=e[a]||[];if(!f.length)return dust.log("Stream broadcasting, but no listeners for `"+a+"`",DEBUG),!1;for(f=f.slice(0),c=0,d=f.length;d>c;c++)f[c](b);return!0},Stream.prototype.on=function(a,b){var c=this.events=this.events||{},d=c[a]=c[a]||[];return"function"!=typeof b?dust.log("No callback function provided for `"+a+"` event listener",WARN):d.push(b),this},Stream.prototype.pipe=function(a){if("function"!=typeof a.write||"function"!=typeof a.end)return dust.log("Incompatible stream passed to `pipe`",WARN),this;var b=!1;return"function"==typeof a.emit&&a.emit("pipe",this),"function"==typeof a.on&&a.on("error",function(){b=!0}),this.on("data",function(c){if(!b)try{a.write(c,"utf8")}catch(d){dust.log(d,ERROR)}}).on("end",function(){if(!b)try{a.end(),b=!0}catch(c){dust.log(c,ERROR)}})},Chunk.prototype.write=function(a){var b=this.taps;return b&&(a=b.go(a)),this.data.push(a),this},Chunk.prototype.end=function(a){return a&&this.write(a),this.flushable=!0,this.root.flush(),this},Chunk.prototype.map=function(a){var b=new Chunk(this.root,this.next,this.taps),c=new Chunk(this.root,b,this.taps);this.next=c,this.flushable=!0;try{a(c)}catch(d){dust.log(d,ERROR),c.setError(d)}return b},Chunk.prototype.tap=function(a){var b=this.taps;return this.taps=b?b.push(a):new Tap(a),this},Chunk.prototype.untap=function(){return this.taps=this.taps.tail,this},Chunk.prototype.render=function(a,b){return a(this,b)},Chunk.prototype.reference=function(a,b,c,d){return"function"==typeof a?(a=a.apply(b.current(),[this,b,null,{auto:c,filters:d}]),a instanceof Chunk?a:this.reference(a,b,c,d)):dust.isThenable(a)?this.await(a,b,null,c,d):dust.isStreamable(a)?this.stream(a,b,null,c,d):dust.isEmpty(a)?this:this.write(dust.filter(a,c,d,b))},Chunk.prototype.section=function(a,b,c,d){var e,f,g,h=c.block,i=c["else"],j=this;if("function"==typeof a&&!dust.isTemplateFn(a)){try{a=a.apply(b.current(),[this,b,c,d])}catch(k){return dust.log(k,ERROR),this.setError(k)}if(a instanceof Chunk)return a}if(dust.isEmptyObject(c))return j;if(dust.isEmptyObject(d)||(b=b.push(d)),dust.isArray(a)){if(h){if(f=a.length,f>0){for(g=b.stack&&b.stack.head||{},g.$len=f,e=0;f>e;e++)g.$idx=e,j=h(j,b.push(a[e],e,f));return g.$idx=void 0,g.$len=void 0,j}if(i)return i(this,b)}}else{if(dust.isThenable(a))return this.await(a,b,c);if(dust.isStreamable(a))return this.stream(a,b,c);if(a===!0){if(h)return h(this,b)}else if(a||0===a){if(h)return h(this,b.push(a))}else if(i)return i(this,b)}return dust.log("Section without corresponding key in template `"+b.getTemplateName()+"`",DEBUG),this},Chunk.prototype.exists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(e)return e(this,b)}else{if(d)return d(this,b);dust.log("No block for exists check in template `"+b.getTemplateName()+"`",DEBUG)}return this},Chunk.prototype.notexists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(d)return d(this,b);dust.log("No block for not-exists check in template `"+b.getTemplateName()+"`",DEBUG)}else if(e)return e(this,b);return this},Chunk.prototype.block=function(a,b,c){var d=a||c.block;return d?d(this,b):this},Chunk.prototype.partial=function(a,b,c,d){var e;return void 0===d&&(d=c,c=b),dust.isEmptyObject(d)||(c=c.clone(),e=c.pop(),c=c.push(d).push(e)),dust.isTemplateFn(a)?this.capture(a,b,function(a,b){c.templateName=a,load(a,b,c).end()}):(c.templateName=a,load(a,this,c))},Chunk.prototype.helper=function(a,b,c,d,e){var f,g=this,h=d.filters;if(void 0===e&&(e="h"),!dust.helpers[a])return dust.log("Helper `"+a+"` does not exist",WARN),g;try{return f=dust.helpers[a](g,b,c,d),f instanceof Chunk?f:("string"==typeof h&&(h=h.split("|")),dust.isEmptyObject(c)?g.reference(f,b,e,h):g.section(f,b,c,d))}catch(i){return dust.log("Error in helper `"+a+"`: "+i.message,ERROR),g.setError(i)}},Chunk.prototype.await=function(a,b,c,d,e){return this.map(function(f){a.then(function(a){f=c?f.section(a,b,c):f.reference(a,b,d,e),f.end()},function(a){var d=c&&c.error;d?f.render(d,b.push(a)).end():(dust.log("Unhandled promise rejection in `"+b.getTemplateName()+"`",INFO),f.end())})})},Chunk.prototype.stream=function(a,b,c,d,e){var f=c&&c.block,g=c&&c.error;return this.map(function(h){var i=!1;a.on("data",function(a){i||(f?h=h.map(function(c){c.render(f,b.push(a)).end()}):c||(h=h.reference(a,b,d,e)))}).on("error",function(a){i||(g?h.render(g,b.push(a)):dust.log("Unhandled stream error in `"+b.getTemplateName()+"`",INFO),i||(i=!0,h.end()))}).on("end",function(){i||(i=!0,h.end())})})},Chunk.prototype.capture=function(a,b,c){return this.map(function(d){var e=new Stub(function(a,b){a?d.setError(a):c(b,d)});a(e.head,b).end()})},Chunk.prototype.setError=function(a){return this.error=a,this.root.flush(),this};for(var f in Chunk.prototype)dust._aliases[f]&&(Chunk.prototype[dust._aliases[f]]=Chunk.prototype[f]);Tap.prototype.push=function(a){return new Tap(a,this)},Tap.prototype.go=function(a){for(var b=this;b;)a=b.head(a),b=b.tail;return a};var HCHARS=/[&<>"']/,AMP=/&/g,LT=//g,QUOT=/\"/g,SQUOT=/\'/g;dust.escapeHtml=function(a){return"string"==typeof a||a&&"function"==typeof a.toString?("string"!=typeof a&&(a=a.toString()),HCHARS.test(a)?a.replace(AMP,"&").replace(LT,"<").replace(GT,">").replace(QUOT,""").replace(SQUOT,"'"):a):a};var BS=/\\/g,FS=/\//g,CR=/\r/g,LS=/\u2028/g,PS=/\u2029/g,NL=/\n/g,LF=/\f/g,SQ=/'/g,DQ=/"/g,TB=/\t/g;return dust.escapeJs=function(a){return"string"==typeof a?a.replace(BS,"\\\\").replace(FS,"\\/").replace(DQ,'\\"').replace(SQ,"\\'").replace(CR,"\\r").replace(LS,"\\u2028").replace(PS,"\\u2029").replace(NL,"\\n").replace(LF,"\\f").replace(TB,"\\t"):a},dust.escapeJSON=function(a){return JSON?JSON.stringify(a).replace(LS,"\\u2028").replace(PS,"\\u2029").replace(LT,"\\u003c"):(dust.log("JSON is undefined; could not escape `"+a+"`",WARN),a)},dust}),function(a,b){"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.parse",["dust.core"],function(dust){return b(dust).parse}):"object"==typeof exports?module.exports=b(require("./dust")):b(a.dust)}(this,function(dust){var a=function(){function a(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}function b(a,b,c,d,e,f){this.message=a,this.expected=b,this.found=c,this.offset=d,this.line=e,this.column=f,this.name="SyntaxError"}function c(a){function c(){return f(wc).line}function d(){return f(wc).column}function e(a){throw h(a,null,wc)}function f(b){function c(b,c,d){var e,f;for(e=c;d>e;e++)f=a.charAt(e),"\n"===f?(b.seenCR||b.line++,b.column=1,b.seenCR=!1):"\r"===f||"\u2028"===f||"\u2029"===f?(b.line++,b.column=1,b.seenCR=!0):(b.column++,b.seenCR=!1)}return xc!==b&&(xc>b&&(xc=0,yc={line:1,column:1,seenCR:!1}),c(yc,xc,b),xc=b),yc}function g(a){zc>vc||(vc>zc&&(zc=vc,Ac=[]),Ac.push(a))}function h(c,d,e){function g(a){var b=1;for(a.sort(function(a,b){return a.descriptionb.description?1:0});b1?g.slice(0,-1).join(", ")+" or "+g[a.length-1]:g[0],e=b?'"'+c(b)+'"':"end of input","Expected "+d+" but "+e+" found."}var i=f(e),j=evc?(j=a.charAt(vc),vc++):(j=X,0===Bc&&g(Eb)),j!==X?(wc=d,e=Fb(j),d=e):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa),d!==X)for(;d!==X;)c.push(d),d=vc,e=vc,Bc++,f=M(),Bc--,f===X?e=da:(vc=e,e=aa),e!==X?(f=vc,Bc++,h=K(),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(h=vc,Bc++,i=L(),Bc--,i===X?h=da:(vc=h,h=aa),h!==X?(i=vc,Bc++,j=R(),Bc--,j===X?i=da:(vc=i,i=aa),i!==X?(a.length>vc?(j=a.charAt(vc),vc++):(j=X,0===Bc&&g(Eb)),j!==X?(wc=d,e=Fb(j),d=e):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa);else c=aa;c!==X&&(wc=b,c=Gb(c)),b=c}return Bc--,b===X&&(c=X,0===Bc&&g(Cb)),b}function I(){var b,c,d,e,f;if(Bc++,b=vc,c=[],d=vc,e=vc,Bc++,f=M(),Bc--,f===X?e=da:(vc=e,e=aa),e!==X?(f=J(),f===X&&(Ib.test(a.charAt(vc))?(f=a.charAt(vc),vc++):(f=X,0===Bc&&g(Jb))),f!==X?(wc=d,e=Fb(f),d=e):(vc=d,d=aa)):(vc=d,d=aa),d!==X)for(;d!==X;)c.push(d),d=vc,e=vc,Bc++,f=M(),Bc--,f===X?e=da:(vc=e,e=aa),e!==X?(f=J(),f===X&&(Ib.test(a.charAt(vc))?(f=a.charAt(vc),vc++):(f=X,0===Bc&&g(Jb))),f!==X?(wc=d,e=Fb(f),d=e):(vc=d,d=aa)):(vc=d,d=aa);else c=aa;return c!==X&&(wc=b,c=Kb(c)),b=c,Bc--,b===X&&(c=X,0===Bc&&g(Hb)),b}function J(){var b,c;return b=vc,a.substr(vc,2)===Lb?(c=Lb,vc+=2):(c=X,0===Bc&&g(Mb)),c!==X&&(wc=b,c=Nb()),b=c}function K(){var b,c,d,e,f,h;if(Bc++,b=vc,a.substr(vc,2)===Pb?(c=Pb,vc+=2):(c=X,0===Bc&&g(Qb)),c!==X){for(d=[],e=vc,f=vc,Bc++,a.substr(vc,2)===Rb?(h=Rb,vc+=2):(h=X,0===Bc&&g(Sb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Tb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);e!==X;)d.push(e),e=vc,f=vc,Bc++,a.substr(vc,2)===Rb?(h=Rb,vc+=2):(h=X,0===Bc&&g(Sb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Tb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);d!==X?(a.substr(vc,2)===Rb?(e=Rb,vc+=2):(e=X,0===Bc&&g(Sb)),e!==X?(wc=b,c=Ub(d),b=c):(vc=b,b=aa)):(vc=b,b=aa)}else vc=b,b=aa;return Bc--,b===X&&(c=X,0===Bc&&g(Ob)),b}function L(){var b,c,d,e,f,h;if(Bc++,b=vc,a.substr(vc,2)===Wb?(c=Wb,vc+=2):(c=X,0===Bc&&g(Xb)),c!==X){for(d=[],e=vc,f=vc,Bc++,a.substr(vc,2)===Yb?(h=Yb,vc+=2):(h=X,0===Bc&&g(Zb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Fb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);e!==X;)d.push(e),e=vc,f=vc,Bc++,a.substr(vc,2)===Yb?(h=Yb,vc+=2):(h=X,0===Bc&&g(Zb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Fb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);d!==X?(a.substr(vc,2)===Yb?(e=Yb,vc+=2):(e=X,0===Bc&&g(Zb)),e!==X?(wc=b,c=$b(d),b=c):(vc=b,b=aa)):(vc=b,b=aa)}else vc=b,b=aa;return Bc--,b===X&&(c=X,0===Bc&&g(Vb)),b}function M(){var b,c,d,e,f,h,i,j,k,l;if(b=vc,c=N(),c!==X){for(d=[],e=S();e!==X;)d.push(e),e=S();if(d!==X)if(_b.test(a.charAt(vc))?(e=a.charAt(vc),vc++):(e=X,0===Bc&&g(ac)),e!==X){for(f=[],h=S();h!==X;)f.push(h),h=S();if(f!==X){if(h=[],i=vc,j=vc,Bc++,k=O(),Bc--,k===X?j=da:(vc=j,j=aa),j!==X?(k=vc,Bc++,l=R(),Bc--,l===X?k=da:(vc=k,k=aa),k!==X?(a.length>vc?(l=a.charAt(vc),vc++):(l=X,0===Bc&&g(Eb)),l!==X?(j=[j,k,l],i=j):(vc=i,i=aa)):(vc=i,i=aa)):(vc=i,i=aa),i!==X)for(;i!==X;)h.push(i),i=vc,j=vc,Bc++,k=O(),Bc--,k===X?j=da:(vc=j,j=aa),j!==X?(k=vc,Bc++,l=R(),Bc--,l===X?k=da:(vc=k,k=aa),k!==X?(a.length>vc?(l=a.charAt(vc),vc++):(l=X,0===Bc&&g(Eb)),l!==X?(j=[j,k,l],i=j):(vc=i,i=aa)):(vc=i,i=aa)):(vc=i,i=aa);else h=aa;if(h!==X){for(i=[],j=S();j!==X;)i.push(j),j=S();i!==X?(j=O(),j!==X?(c=[c,d,e,f,h,i,j],b=c):(vc=b,b=aa)):(vc=b,b=aa)}else vc=b,b=aa}else vc=b,b=aa}else vc=b,b=aa;else vc=b,b=aa}else vc=b,b=aa;return b===X&&(b=r()),b}function N(){var b;return 123===a.charCodeAt(vc)?(b=bc,vc++):(b=X,0===Bc&&g(cc)),b}function O(){var b;return 125===a.charCodeAt(vc)?(b=dc,vc++):(b=X,0===Bc&&g(ec)),b}function P(){var b;return 91===a.charCodeAt(vc)?(b=fc,vc++):(b=X,0===Bc&&g(gc)),b}function Q(){var b;return 93===a.charCodeAt(vc)?(b=hc,vc++):(b=X,0===Bc&&g(ic)),b}function R(){var b;return 10===a.charCodeAt(vc)?(b=jc,vc++):(b=X,0===Bc&&g(kc)),b===X&&(a.substr(vc,2)===lc?(b=lc,vc+=2):(b=X,0===Bc&&g(mc)),b===X&&(13===a.charCodeAt(vc)?(b=nc,vc++):(b=X,0===Bc&&g(oc)),b===X&&(8232===a.charCodeAt(vc)?(b=pc,vc++):(b=X,0===Bc&&g(qc)),b===X&&(8233===a.charCodeAt(vc)?(b=rc,vc++):(b=X,0===Bc&&g(sc)))))),b}function S(){var b;return tc.test(a.charAt(vc))?(b=a.charAt(vc),vc++):(b=X,0===Bc&&g(uc)),b===X&&(b=R()),b}function T(a){return parseInt(a.join(""),10)}function U(a){return a.concat([["line",c()],["col",d()]])}var V,W=arguments.length>1?arguments[1]:{},X={},Y={start:i},Z=i,$=function(a){var b=["body"].concat(a);return U(b)},_={type:"other",description:"section"},aa=X,ba=null,ca=function(a,b,c,d){return d&&a[1].text===d.text||e("Expected end tag for "+a[1].text+" but it was not found."),!0},da=void 0,ea=function(a,b,c){return c.push(["param",["literal","block"],b]),a.push(c,["filters"]),U(a)},fa="/",ga={type:"literal",value:"/",description:'"/"'},ha=function(a){return a.push(["bodies"],["filters"]),U(a)},ia=/^[#?\^<+@%]/,ja={type:"class",value:"[#?\\^<+@%]",description:"[#?\\^<+@%]"},ka=function(a,b,c,d){return[a,b,c,d]},la={type:"other",description:"end tag"},ma=function(a){return a},na=":",oa={type:"literal",value:":",description:'":"'},pa=function(a){return a},qa=function(a){return a?["context",a]:["context"]},ra={type:"other",description:"params"},sa="=",ta={type:"literal",value:"=",description:'"="'},ua=function(a,b){return["param",["literal",a],b]},va=function(a){return["params"].concat(a)},wa={type:"other",description:"bodies"},xa=function(a){return["bodies"].concat(a)},ya={type:"other",description:"reference"},za=function(a,b){return U(["reference",a,b])},Aa={type:"other",description:"partial"},Ba=">",Ca={type:"literal",value:">",description:'">"'},Da="+",Ea={type:"literal",value:"+",description:'"+"'},Fa=function(a){return["literal",a]},Ga=function(a,b,c,d){var e=">"===a?"partial":a;return U([e,b,c,d])},Ha={type:"other",description:"filters"},Ia="|",Ja={type:"literal",value:"|",description:'"|"'},Ka=function(a){return["filters"].concat(a)},La={type:"other",description:"special"},Ma="~",Na={type:"literal",value:"~",description:'"~"'},Oa=function(a){return U(["special",a])},Pa={type:"other",description:"identifier"},Qa=function(a){var b=["path"].concat(a);return b.text=a[1].join(".").replace(/,line,\d+,col,\d+/g,""),b},Ra=function(a){var b=["key",a];return b.text=a,b},Sa={type:"other",description:"number"},Ta=function(a){return["literal",a]},Ua={type:"other",description:"float"},Va=".",Wa={type:"literal",value:".",description:'"."'},Xa=function(a,b){return parseFloat(a+"."+b)},Ya={type:"other",description:"unsigned_integer"},Za=/^[0-9]/,$a={type:"class",value:"[0-9]",description:"[0-9]"},_a=function(a){return T(a)},ab={type:"other",description:"signed_integer"},bb="-",cb={type:"literal",value:"-",description:'"-"'},db=function(a,b){return-1*b},eb={type:"other",description:"integer"},fb={type:"other",description:"path"},gb=function(a,b){return b=b[0],a&&b?(b.unshift(a),U([!1,b])):U([!0,b])},hb=function(a){return U(a.length>0?[!0,a[0]]:[!0,[]])},ib={type:"other",description:"key"},jb=/^[a-zA-Z_$]/,kb={type:"class",value:"[a-zA-Z_$]",description:"[a-zA-Z_$]"},lb=/^[0-9a-zA-Z_$\-]/,mb={type:"class",value:"[0-9a-zA-Z_$\\-]",description:"[0-9a-zA-Z_$\\-]"},nb=function(a,b){return a+b.join("")},ob={type:"other",description:"array"},pb=function(a){return a.join("")},qb=function(a){return a},rb=function(a,b){return b?b.unshift(a):b=[a],b},sb={type:"other",description:"array_part"},tb=function(a){return a},ub=function(a,b){return b?a.concat(b):a},vb={type:"other",description:"inline"},wb='"',xb={type:"literal",value:'"',description:'"\\""'},yb=function(){return U(["literal",""])},zb=function(a){return U(["literal",a])},Ab=function(a){return U(["body"].concat(a))},Bb=function(a){return["buffer",a]},Cb={type:"other",description:"buffer"},Db=function(a,b){return U(["format",a,b.join("")])},Eb={type:"any",description:"any character"},Fb=function(a){return a},Gb=function(a){return U(["buffer",a.join("")])},Hb={type:"other",description:"literal"},Ib=/^[^"]/,Jb={type:"class",value:'[^"]',description:'[^"]'},Kb=function(a){return a.join("")},Lb='\\"',Mb={type:"literal",value:'\\"',description:'"\\\\\\""'},Nb=function(){return'"'},Ob={type:"other",description:"raw"},Pb="{`",Qb={type:"literal",value:"{`",description:'"{`"'},Rb="`}",Sb={type:"literal",value:"`}",description:'"`}"'},Tb=function(a){return a},Ub=function(a){return U(["raw",a.join("")])},Vb={type:"other",description:"comment"},Wb="{!",Xb={type:"literal",value:"{!",description:'"{!"'},Yb="!}",Zb={type:"literal",value:"!}",description:'"!}"'},$b=function(a){return U(["comment",a.join("")])},_b=/^[#?\^><+%:@\/~%]/,ac={type:"class",value:"[#?\\^><+%:@\\/~%]",description:"[#?\\^><+%:@\\/~%]"},bc="{",cc={type:"literal",value:"{",description:'"{"'},dc="}",ec={type:"literal",value:"}",description:'"}"'},fc="[",gc={type:"literal",value:"[",description:'"["'},hc="]",ic={type:"literal",value:"]",description:'"]"' +},jc="\n",kc={type:"literal",value:"\n",description:'"\\n"'},lc="\r\n",mc={type:"literal",value:"\r\n",description:'"\\r\\n"'},nc="\r",oc={type:"literal",value:"\r",description:'"\\r"'},pc="\u2028",qc={type:"literal",value:"\u2028",description:'"\\u2028"'},rc="\u2029",sc={type:"literal",value:"\u2029",description:'"\\u2029"'},tc=/^[\t\x0B\f \xA0\uFEFF]/,uc={type:"class",value:"[\\t\\x0B\\f \\xA0\\uFEFF]",description:"[\\t\\x0B\\f \\xA0\\uFEFF]"},vc=0,wc=0,xc=0,yc={line:1,column:1,seenCR:!1},zc=0,Ac=[],Bc=0;if("startRule"in W){if(!(W.startRule in Y))throw new Error("Can't start parsing from rule \""+W.startRule+'".');Z=Y[W.startRule]}if(V=Z(),V!==X&&vc===a.length)return V;throw V!==X&&vcc;c++)e=r.filterNode(a,b[c]),e&&f.push(e);return f}function d(a,b){var c,d,e,f,g=[b[0]];for(d=1,e=b.length;e>d;d++)f=r.filterNode(a,b[d]),f&&("buffer"===f[0]||"format"===f[0]?c?(c[0]="buffer"===f[0]?"buffer":c[0],c[1]+=f.slice(1,-2).join("")):(c=f,g.push(f)):(c=null,g.push(f)));return g}function e(a,b){return["buffer",t[b[1]],b[2],b[3]]}function f(a,b){return b}function g(){}function h(a,b){return dust.config.whitespace?(b.splice(1,2,b.slice(1,-2).join("")),b):null}function i(a,b){var c,d={name:b,bodies:[],blocks:{},index:0,auto:"h"},e=dust.escapeJs(b),f=b?'"'+e+'",':"",g="function(dust){",h=r.compileNode(d,a);return b&&(g+='dust.register("'+e+'",'+h+");"),g+=j(d)+k(d)+"return "+h+"}",c="("+g+"(dust));",dust.config.amd?"define("+f+'["dust.core"],'+g+");":dust.config.cjs?"module.exports=function(dust){var tmpl="+c+"var f="+q().toString()+";f.template=tmpl;return f}":c}function j(a){var b,c=[],d=a.blocks;for(b in d)c.push('"'+b+'":'+d[b]);return c.length?(a.blocks="ctx=ctx.shiftBlocks(blocks);","var blocks={"+c.join(",")+"};"):(a.blocks="",a.blocks)}function k(a){var b,c,d=[],e=a.bodies,f=a.blocks;for(b=0,c=e.length;c>b;b++)d[b]="function body_"+b+"(chk,ctx){"+f+"return chk"+e[b]+";}body_"+b+".__dustBody=!0;";return d.join("")}function l(a,b){var c,d,e="";for(c=1,d=b.length;d>c;c++)e+=r.compileNode(a,b[c]);return e}function m(a,b,c){return"."+(dust._aliases[c]||c)+"("+r.compileNode(a,b[1])+","+r.compileNode(a,b[2])+","+r.compileNode(a,b[4])+","+r.compileNode(a,b[3])+")"}function n(a){return a.replace(u,"\\\\").replace(v,'\\"').replace(w,"\\f").replace(x,"\\n").replace(y,"\\r").replace(z,"\\t")}function o(a,b,c){var d=dust.loadSource(dust.compile(a));return q(d)(b,c)}function p(a,b){var c=dust.loadSource(dust.compile(a,b));return q(c)}function q(a){return function(b,c){var d=c?"render":"stream";return dust[d](a,b,c)}}var r={},s=dust.isArray;r.compile=function(c,d){try{var e=b(a(c));return i(e,d)}catch(f){if(!f.line||!f.column)throw f;throw new SyntaxError(f.message+" At line : "+f.line+", column : "+f.column)}},r.filterNode=function(a,b){return r.optimizers[b[0]](a,b)},r.optimizers={body:d,buffer:f,special:e,format:h,reference:c,"#":c,"?":c,"^":c,"<":c,"+":c,"@":c,"%":c,partial:c,context:c,params:c,bodies:c,param:c,filters:f,key:f,path:f,literal:f,raw:f,comment:g,line:g,col:g},r.pragmas={esc:function(a,b,c){var d,e=a.auto;return b||(b="h"),a.auto="s"===b?"":b,d=l(a,c.block),a.auto=e,d}};var t={s:" ",n:"\n",r:"\r",lb:"{",rb:"}"};r.compileNode=function(a,b){return r.nodes[b[0]](a,b)},r.nodes={body:function(a,b){var c=a.index++,d="body_"+c;return a.bodies[c]=l(a,b),d},buffer:function(a,b){return".w("+A(b[1])+")"},format:function(a,b){return".w("+A(b[1])+")"},reference:function(a,b){return".f("+r.compileNode(a,b[1])+",ctx,"+r.compileNode(a,b[2])+")"},"#":function(a,b){return m(a,b,"section")},"?":function(a,b){return m(a,b,"exists")},"^":function(a,b){return m(a,b,"notexists")},"<":function(a,b){for(var c=b[4],d=1,e=c.length;e>d;d++){var f=c[d],g=f[1][1];if("block"===g)return a.blocks[b[1].text]=r.compileNode(a,f[2]),""}return""},"+":function(a,b){return"undefined"==typeof b[1].text&&"undefined"==typeof b[4]?".b(ctx.getBlock("+r.compileNode(a,b[1])+",chk, ctx),"+r.compileNode(a,b[2])+", {},"+r.compileNode(a,b[3])+")":".b(ctx.getBlock("+A(b[1].text)+"),"+r.compileNode(a,b[2])+","+r.compileNode(a,b[4])+","+r.compileNode(a,b[3])+")"},"@":function(a,b){return".h("+A(b[1].text)+","+r.compileNode(a,b[2])+","+r.compileNode(a,b[4])+","+r.compileNode(a,b[3])+","+r.compileNode(a,b[5])+")"},"%":function(a,b){var c,d,e,f,g,h,i,j,k,l=b[1][1];if(!r.pragmas[l])return"";for(c=b[4],d={},j=1,k=c.length;k>j;j++)h=c[j],d[h[1][1]]=h[2];for(e=b[3],f={},j=1,k=e.length;k>j;j++)i=e[j],f[i[1][1]]=i[2][1];return g=b[2][1]?b[2][1].text:null,r.pragmas[l](a,g,d,f)},partial:function(a,b){return".p("+r.compileNode(a,b[1])+",ctx,"+r.compileNode(a,b[2])+","+r.compileNode(a,b[3])+")"},context:function(a,b){return b[1]?"ctx.rebase("+r.compileNode(a,b[1])+")":"ctx"},params:function(a,b){for(var c=[],d=1,e=b.length;e>d;d++)c.push(r.compileNode(a,b[d]));return c.length?"{"+c.join(",")+"}":"{}"},bodies:function(a,b){for(var c=[],d=1,e=b.length;e>d;d++)c.push(r.compileNode(a,b[d]));return"{"+c.join(",")+"}"},param:function(a,b){return r.compileNode(a,b[1])+":"+r.compileNode(a,b[2])},filters:function(a,b){for(var c=[],d=1,e=b.length;e>d;d++){var f=b[d];c.push('"'+f+'"')}return'"'+a.auto+'"'+(c.length?",["+c.join(",")+"]":"")},key:function(a,b){return'ctx.get(["'+b[1]+'"], false)'},path:function(a,b){for(var c=b[1],d=b[2],e=[],f=0,g=d.length;g>f;f++)e.push(s(d[f])?r.compileNode(a,d[f]):'"'+d[f]+'"');return"ctx.getPath("+c+", ["+e.join(",")+"])"},literal:function(a,b){return A(b[1])},raw:function(a,b){return".w("+A(b[1])+")"}};var u=/\\/g,v=/"/g,w=/\f/g,x=/\n/g,y=/\r/g,z=/\t/g,A="undefined"==typeof JSON?function(a){return'"'+n(a)+'"'}:JSON.stringify;return dust.compiler=r,dust.compile=dust.compiler.compile,dust.renderSource=o,dust.compileFn=p,dust.filterNode=r.filterNode,dust.optimizers=r.optimizers,dust.pragmas=r.pragmas,dust.compileNode=r.compileNode,dust.nodes=r.nodes,r}),"function"==typeof define&&define.amd&&define.amd.dust===!0&&define(["require","dust.core","dust.compile"],function(require,dust){return dust.onLoad=function(a,b){require([a],function(){b()})},dust}); \ No newline at end of file diff --git a/lib/dust.js b/lib/dust.js index 3afdecc6..d0196a60 100644 --- a/lib/dust.js +++ b/lib/dust.js @@ -8,7 +8,7 @@ } }(this, function() { var dust = { - "version": "2.7.3" + "version": "2.7.4" }, NONE = 'NONE', ERROR = 'ERROR', WARN = 'WARN', INFO = 'INFO', DEBUG = 'DEBUG', EMPTY_FUNC = function() {}; diff --git a/package.json b/package.json index 7fca29f5..c83eecbf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dustjs-linkedin", - "version": "2.7.3", + "version": "2.7.4", "author": { "name": "Aleksander Williams", "url": "http://akdubya.github.com/dustjs" From d0f955d65d4fafcc6a9fdf3fa5af452b0d96a238 Mon Sep 17 00:00:00 2001 From: danactive Date: Mon, 5 Dec 2016 09:44:31 -0800 Subject: [PATCH 4/5] Decrease security vulnerabilities by upgrading cli dependency (#754 #748) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c83eecbf..9132877f 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ ], "dependencies": { "chokidar": "~1.5.1", - "cli": "~0.11.2" + "cli": "^1.0.1" }, "devDependencies": { "ayepromise": "~1.1.1", From 822222e731ada4c3a70b258ac95ad3f442e26955 Mon Sep 17 00:00:00 2001 From: Jimmy Chan Date: Fri, 9 Dec 2016 08:50:14 -0500 Subject: [PATCH 5/5] Release v2.7.5 --- CHANGELOG.md | 35 ++++++++++++++++++++++++----------- bower.json | 2 +- dist/dust-core.js | 4 ++-- dist/dust-core.min.js | 4 ++-- dist/dust-full.js | 4 ++-- dist/dust-full.min.js | 4 ++-- lib/dust.js | 2 +- package.json | 2 +- 8 files changed, 35 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 178eae29..32fae98b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,21 +1,34 @@ ## Change Log -### v2.7.4 (2016/09/13 02:50 +00:00) +### v2.7.5 (2016/12/09 13:49 +00:00) +- [#756](https://github.com/linkedin/dustjs/pull/756) Decrease security vulnerabilities by upgrading cli dependency (#754 #748) (@danactive) + +### v2.7.4 (2016/09/13 02:52 +00:00) - [#744](https://github.com/linkedin/dustjs/pull/744) Don't use instanceof to determine if a Context is a Context. Instead use a flag on the instance itself so it can survive object merges. (@sethkinast) +### v2.6.3 (2016/07/26 18:03 +00:00) +- [#736](https://github.com/linkedin/dustjs/pull/736) Prioritize resolution of .then (@brianmhunt) +- [#734](https://github.com/linkedin/dustjs/pull/734) Bump deps (@sethkinast) +- [#703](https://github.com/linkedin/dustjs/pull/703) Upgrade to peg.js 0.9 (@sethkinast) +- [#705](https://github.com/linkedin/dustjs/pull/705) When rendering with a Context object, use the templateName provided by the template (@sethkinast) +- [#701](https://github.com/linkedin/dustjs/pull/701) Fix stacktrace logging for IE8 (@sethkinast) +- [#700](https://github.com/linkedin/dustjs/pull/700) At `DEBUG` loglevel, log the full stack trace on errors (@r1b) +- [#690](https://github.com/linkedin/dustjs/pull/690) Update deps (@sethkinast) +- [#689](https://github.com/linkedin/dustjs/pull/689) Make the AMD loader pass the template directly rather than communicating via the cache (@aredridel) + ### v2.7.2 (2015/06/08 20:41 +00:00) - [#673](https://github.com/linkedin/dustjs/pull/673) Pass the current context to filters (@sethkinast) -- [#676](https://github.com/linkedin/dustjs/pull/676) If a Promise is resolved with an array, iterate over it instead of rendering the whole array at once. Closes #674 (@sethkinast) -- [#647](https://github.com/linkedin/dustjs/pull/647) Allow helpers to return primitives Previously returning a primitive would crash rendering with no way to recover. You can still return a Chunk and do more complex work if you need to. Helpers act like references or sections depending on if they have a body. When they have no body, they act like a reference and look in `params.filters` for filters to use. When they have a body, they act like a section. You can return thenables and streams normally. {@return value="" filters="|s" /} {@return value=""}{.} World{/return} Closes #645 (@sethkinast) -- [#664](https://github.com/linkedin/dustjs/pull/664) Be slightly pickier about what Dust thinks a Stream is. Closes #663 (@sethkinast) +- [#676](https://github.com/linkedin/dustjs/pull/676) If a Promise is resolved with an array, iterate over it instead of rendering the whole array at once. Closes #674 (@sethkinast) +- [#647](https://github.com/linkedin/dustjs/pull/647) Allow helpers to return primitives Previously returning a primitive would crash rendering with no way to recover. You can still return a Chunk and do more complex work if you need to. Helpers act like references or sections depending on if they have a body. When they have no body, they act like a reference and look in `params.filters` for filters to use. When they have a body, they act like a section. You can return thenables and streams normally. {@return value="" filters="|s" /} {@return value=""}{.} World{/return} Closes #645 (@sethkinast) +- [#664](https://github.com/linkedin/dustjs/pull/664) Be slightly pickier about what Dust thinks a Stream is. Closes #663 (@sethkinast) - [#661](https://github.com/linkedin/dustjs/pull/661) Add saucelabs integration (@sethkinast) -- [#658](https://github.com/linkedin/dustjs/pull/658) Refactor testing frameworks Closes #649 Closes #602 Closes #642 (@sethkinast) -- [#660](https://github.com/linkedin/dustjs/pull/660) Grammar: s/char/character/ to avoid using a reserved name Closes #659 (@sethkinast) +- [#658](https://github.com/linkedin/dustjs/pull/658) Refactor testing frameworks Closes #649 Closes #602 Closes #642 (@sethkinast) +- [#660](https://github.com/linkedin/dustjs/pull/660) Grammar: s/char/character/ to avoid using a reserved name Closes #659 (@sethkinast) ### v2.7.1 (2015/04/30 20:32 +00:00) - [#655](https://github.com/linkedin/dustjs/pull/655) Update CommonJS example to make use of new onLoad behavior (@sethkinast) - [#653](https://github.com/linkedin/dustjs/pull/653) Fix array iteration when context is undefined (@sethkinast) -- [#641](https://github.com/linkedin/dustjs/pull/641) Add a `cb(null, compiledTemplate)` signature to `dust.onLoad` Calling the `onLoad` callback with a compiled template function will use this template to satisfy the load request. The template is not automatically registered under any name when passed to the callback, so the `onLoad` function should handle registration as it needs. `dust.cache` behavior has been changed slightly. Before, setting it to false would blow away the entire cache on every render. Now, setting it to false just prevents new templates from being added and cached templates from being used, but if it's set to true again previously-cached templates will be ready to use. (@sethkinast) +- [#641](https://github.com/linkedin/dustjs/pull/641) Add a `cb(null, compiledTemplate)` signature to `dust.onLoad` Calling the `onLoad` callback with a compiled template function will use this template to satisfy the load request. The template is not automatically registered under any name when passed to the callback, so the `onLoad` function should handle registration as it needs. `dust.cache` behavior has been changed slightly. Before, setting it to false would blow away the entire cache on every render. Now, setting it to false just prevents new templates from being added and cached templates from being used, but if it's set to true again previously-cached templates will be ready to use. (@sethkinast) - [#650](https://github.com/linkedin/dustjs/pull/650) Pin jasmine@2.2.x for grunt-jasmine-nodejs (@sethkinast) - [#646](https://github.com/linkedin/dustjs/pull/646) Update AMD and CommonJS examples (@sethkinast) - [#637](https://github.com/linkedin/dustjs/pull/637) CommonJS example (@sethkinast) @@ -27,7 +40,7 @@ - [#633](https://github.com/linkedin/dustjs/pull/633) Drop Node 0.8 (@sethkinast) - [#635](https://github.com/linkedin/dustjs/pull/635) Resolve dynamic partial names via original context (@sethkinast) - [#631](https://github.com/linkedin/dustjs/pull/631) Try to avoid creating Stacks with no content when possible (@sethkinast) -- [#613](https://github.com/linkedin/dustjs/pull/613) Refactor template compilation * `dust.render` and `dust.stream` now accept a compiled template function in addition to a template name. * `dust.compile` no longer requires a template name, and will compile an anonymous template without one (so `--name` is no longer required for dustc either) * `dust.load` is removed from the public API * `dust.renderSource` is moved to the compiler, so it's only included in dust-full now (Fixes #412) * `dust.compileFn` is moved to the compiler, so it's only included in dust-full now * add `dust.isTemplateFn` * add `dust.config.cache = true`, set to `false` to disable caching and load templates again every time (Fixes #451) * add `dust.config.cjs = false`, set to `true` to compile templates as CommonJS modules * add `--cjs` flag to `dustc` * Move a bunch of exposed compiler stuff under `dust.compiler` (but leave it exposed until 2.8) (@sethkinast) +- [#613](https://github.com/linkedin/dustjs/pull/613) Refactor template compilation * `dust.render` and `dust.stream` now accept a compiled template function in addition to a template name. * `dust.compile` no longer requires a template name, and will compile an anonymous template without one (so `--name` is no longer required for dustc either) * `dust.load` is removed from the public API * `dust.renderSource` is moved to the compiler, so it's only included in dust-full now (Fixes #412) * `dust.compileFn` is moved to the compiler, so it's only included in dust-full now * add `dust.isTemplateFn` * add `dust.config.cache = true`, set to `false` to disable caching and load templates again every time (Fixes #451) * add `dust.config.cjs = false`, set to `true` to compile templates as CommonJS modules * add `--cjs` flag to `dustc` * Move a bunch of exposed compiler stuff under `dust.compiler` (but leave it exposed until 2.8) (@sethkinast) - [#624](https://github.com/linkedin/dustjs/pull/624) dustc always creates templates with forward slashes (@sethkinast) - [#617](https://github.com/linkedin/dustjs/pull/617) Add `chunk.stream` to allow streamables in context (@sethkinast) - [#610](https://github.com/linkedin/dustjs/pull/610) clean up PEG grammar a little bit (@sethkinast) @@ -92,11 +105,11 @@ - [#493](https://github.com/linkedin/dustjs/pull/493) Update changelog to 2.4.0 (@prashn64) ### v2.4.0 (2014/06/11 01:32 +00:00) -- [#472](https://github.com/linkedin/dustjs/pull/472) #469 Prevent references from looking in the prototype. Previously, {arr.sort} was possible even if sort was not a function in the arr object, since it was looking in the Array prototype. (@jimmyhchan) +- [#472](https://github.com/linkedin/dustjs/pull/472) #469 Prevent references from looking in the prototype. Previously, {arr.sort} was possible even if sort was not a function in the arr object, since it was looking in the Array prototype. (@jimmyhchan) - [#441](https://github.com/linkedin/dustjs/pull/441) Make default params type to an object instead of null (@prashn64) - [#447](https://github.com/linkedin/dustjs/pull/447) deprecate the internal property context.isFunction. this is no longer needed. (@prashn64) - [#424](https://github.com/linkedin/dustjs/pull/424) Set up dev flow with grunt and fix coverage report (@kate2753) -- [#471](https://github.com/linkedin/dustjs/pull/471) Errors thrown from render will now call populate the error in the callback. Previously, thrown errors will immediately fail and not call the callback. Issue #381, Address #468: Errors thrown from stream now will invoke the `error` listener with the error object. Previously, these errors could not be caught and the process will hang. Deprecated/remove: `dust.onError`, `dust.silenceErrors`. To see runtime errors, look at the error in the callback. breaking change: `dust.log` with an error no longer throws that error (@prashn64) +- [#471](https://github.com/linkedin/dustjs/pull/471) Errors thrown from render will now call populate the error in the callback. Previously, thrown errors will immediately fail and not call the callback. Issue #381, Address #468: Errors thrown from stream now will invoke the `error` listener with the error object. Previously, these errors could not be caught and the process will hang. Deprecated/remove: `dust.onError`, `dust.silenceErrors`. To see runtime errors, look at the error in the callback. breaking change: `dust.log` with an error no longer throws that error (@prashn64) - [#475](https://github.com/linkedin/dustjs/pull/475) remove config set on before install for travis build (@prashn64) - [#474](https://github.com/linkedin/dustjs/pull/474) travis build fix for minimatch grunt module (@prashn64) - [#470](https://github.com/linkedin/dustjs/pull/470) Ensure client bundlers load only client-side code (@patrick-steele-idem) @@ -269,4 +282,4 @@ - [#9](https://github.com/linkedin/dustjs/pull/9) Update to 0.4.0 in dist so that docs are correct (@kmiyashiro) - [#5](https://github.com/linkedin/dustjs/pull/5) Quote 'if' helper, fixes #4 (@kmiyashiro) - [#3](https://github.com/linkedin/dustjs/pull/3) Gaurd against browsers (@Raynos) -- [#25](https://github.com/linkedin/dustjs/pull/25) process.binding('evals') is now require('vm') (@stonecobra) +- [#25](https://github.com/linkedin/dustjs/pull/25) process.binding('evals') is now require('vm') (@stonecobra) \ No newline at end of file diff --git a/bower.json b/bower.json index e1e1a057..4fd6a6f8 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "dustjs-linkedin", - "version": "2.7.4", + "version": "2.7.5", "homepage": "https://github.com/linkedin/dustjs", "authors": [ "Veena Basavaraj ", diff --git a/dist/dust-core.js b/dist/dust-core.js index d6b37672..10afb21b 100644 --- a/dist/dust-core.js +++ b/dist/dust-core.js @@ -1,4 +1,4 @@ -/*! dustjs-linkedin - v2.7.4 +/*! dustjs-linkedin - v2.7.5 * http://dustjs.com/ * Copyright (c) 2016 Aleksander Williams; Released under the MIT License */ (function (root, factory) { @@ -11,7 +11,7 @@ } }(this, function() { var dust = { - "version": "2.7.4" + "version": "2.7.5" }, NONE = 'NONE', ERROR = 'ERROR', WARN = 'WARN', INFO = 'INFO', DEBUG = 'DEBUG', EMPTY_FUNC = function() {}; diff --git a/dist/dust-core.min.js b/dist/dust-core.min.js index 66d86013..92d2725d 100644 --- a/dist/dust-core.min.js +++ b/dist/dust-core.min.js @@ -1,4 +1,4 @@ -/*! dustjs-linkedin - v2.7.4 +/*! dustjs-linkedin - v2.7.5 * http://dustjs.com/ * Copyright (c) 2016 Aleksander Williams; Released under the MIT License */ -!function(a,b){"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.core",[],b):"object"==typeof exports?module.exports=b():a.dust=b()}(this,function(){function getTemplate(a,b){return a?"function"==typeof a&&a.template?a.template:dust.isTemplateFn(a)?a:b!==!1?dust.cache[a]:void 0:void 0}function load(a,b,c){if(!a)return b.setError(new Error("No template or template name provided to render"));var d=getTemplate(a,dust.config.cache);return d?d(b,Context.wrap(c,d.templateName)):dust.onLoad?b.map(function(b){function d(a,d){var f;if(a)return b.setError(a);if(f=getTemplate(d,!1)||getTemplate(e,dust.config.cache),!f){if(!dust.compile)return b.setError(new Error("Dust compiler not available"));f=dust.loadSource(dust.compile(d,e))}f(b,Context.wrap(c,f.templateName)).end()}var e=a;3===dust.onLoad.length?dust.onLoad(e,c.options,d):dust.onLoad(e,d)}):b.setError(new Error("Template Not Found: "+a))}function Context(a,b,c,d,e){void 0===a||a instanceof Stack||(a=new Stack(a)),this.stack=a,this.global=b,this.options=c,this.blocks=d,this.templateName=e,this._isContext=!0}function getWithResolvedData(a,b,c){return function(d){return a.push(d)._get(b,c)}}function Stack(a,b,c,d){this.tail=b,this.isObject=a&&"object"==typeof a,this.head=a,this.index=c,this.of=d}function Stub(a){this.head=new Chunk(this),this.callback=a,this.out=""}function Stream(){this.head=new Chunk(this)}function Chunk(a,b,c){this.root=a,this.next=b,this.data=[],this.flushable=!1,this.taps=c}function Tap(a,b){this.head=a,this.tail=b}var dust={version:"2.7.4"},NONE="NONE",ERROR="ERROR",WARN="WARN",INFO="INFO",DEBUG="DEBUG",EMPTY_FUNC=function(){};dust.config={whitespace:!1,amd:!1,cjs:!1,cache:!0},dust._aliases={write:"w",end:"e",map:"m",render:"r",reference:"f",section:"s",exists:"x",notexists:"nx",block:"b",partial:"p",helper:"h"},function(){var a,b,c={DEBUG:0,INFO:1,WARN:2,ERROR:3,NONE:4};"undefined"!=typeof console&&console.log?(a=console.log,b="function"==typeof a?function(){a.apply(console,arguments)}:function(){a(Array.prototype.slice.apply(arguments).join(" "))}):b=EMPTY_FUNC,dust.log=function(a,d){d=d||INFO,c[d]>=c[dust.debugLevel]&&b("[DUST:"+d+"]",a)},dust.debugLevel=NONE,"undefined"!=typeof process&&process.env&&/\bdust\b/.test(process.env.DEBUG)&&(dust.debugLevel=DEBUG)}(),dust.helpers={},dust.cache={},dust.register=function(a,b){a&&(b.templateName=a,dust.config.cache!==!1&&(dust.cache[a]=b))},dust.render=function(a,b,c){var d=new Stub(c).head;try{load(a,d,b).end()}catch(e){d.setError(e)}},dust.stream=function(a,b){var c=new Stream,d=c.head;return dust.nextTick(function(){try{load(a,d,b).end()}catch(c){d.setError(c)}}),c},dust.loadSource=function(source){return eval(source)},dust.isArray=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},dust.nextTick=function(){return function(a){setTimeout(a,0)}}(),dust.isEmpty=function(a){return 0===a?!1:dust.isArray(a)&&!a.length?!0:!a},dust.isEmptyObject=function(a){var b;if(null===a)return!1;if(void 0===a)return!1;if(a.length>0)return!1;for(b in a)if(Object.prototype.hasOwnProperty.call(a,b))return!1;return!0},dust.isTemplateFn=function(a){return"function"==typeof a&&a.__dustBody},dust.isThenable=function(a){return a&&"object"==typeof a&&"function"==typeof a.then},dust.isStreamable=function(a){return a&&"function"==typeof a.on&&"function"==typeof a.pipe},dust.filter=function(a,b,c,d){var e,f,g,h;if(c)for(e=0,f=c.length;f>e;e++)g=c[e],g.length&&(h=dust.filters[g],"s"===g?b=null:"function"==typeof h?a=h(a,d):dust.log("Invalid filter `"+g+"`",WARN));return b&&(a=dust.filters[b](a,d)),a},dust.filters={h:function(a){return dust.escapeHtml(a)},j:function(a){return dust.escapeJs(a)},u:encodeURI,uc:encodeURIComponent,js:function(a){return dust.escapeJSON(a)},jp:function(a){return JSON?JSON.parse(a):(dust.log("JSON is undefined; could not parse `"+a+"`",WARN),a)}},dust.makeBase=dust.context=function(a,b){return new Context(void 0,a,b)},dust.isContext=function(a){return"object"==typeof a&&a._isContext===!0},Context.wrap=function(a,b){return dust.isContext(a)?a:new Context(a,{},{},null,b)},Context.prototype.get=function(a,b){return"string"==typeof a&&("."===a[0]&&(b=!0,a=a.substr(1)),a=a.split(".")),this._get(b,a)},Context.prototype._get=function(a,b){var c,d,e,f,g,h=this.stack||{},i=1;if(d=b[0],e=b.length,a&&0===e)f=h,h=h.head;else{if(a)h&&(h=h.head?h.head[d]:void 0);else{for(;h&&(!h.isObject||(f=h.head,c=h.head[d],void 0===c));)h=h.tail;h=void 0!==c?c:this.global&&this.global[d]}for(;h&&e>i;){if(dust.isThenable(h))return h.then(getWithResolvedData(this,a,b.slice(i)));f=h,h=h[b[i]],i++}}return"function"==typeof h?(g=function(){try{return h.apply(f,arguments)}catch(a){throw dust.log(a,ERROR),a}},g.__dustBody=!!h.__dustBody,g):(void 0===h&&dust.log("Cannot find reference `{"+b.join(".")+"}` in template `"+this.getTemplateName()+"`",INFO),h)},Context.prototype.getPath=function(a,b){return this._get(a,b)},Context.prototype.push=function(a,b,c){return void 0===a?(dust.log("Not pushing an undefined variable onto the context",INFO),this):this.rebase(new Stack(a,this.stack,b,c))},Context.prototype.pop=function(){var a=this.current();return this.stack=this.stack&&this.stack.tail,a},Context.prototype.rebase=function(a){return new Context(a,this.global,this.options,this.blocks,this.getTemplateName())},Context.prototype.clone=function(){var a=this.rebase();return a.stack=this.stack,a},Context.prototype.current=function(){return this.stack&&this.stack.head},Context.prototype.getBlock=function(a){var b,c,d;if("function"==typeof a&&(a=a(new Chunk,this).data.join("")),b=this.blocks,!b)return dust.log("No blocks for context `"+a+"` in template `"+this.getTemplateName()+"`",DEBUG),!1;for(c=b.length;c--;)if(d=b[c][a])return d;return dust.log("Malformed template `"+this.getTemplateName()+"` was missing one or more blocks."),!1},Context.prototype.shiftBlocks=function(a){var b,c=this.blocks;return a?(b=c?c.concat([a]):[a],new Context(this.stack,this.global,this.options,b,this.getTemplateName())):this},Context.prototype.resolve=function(a){var b;return"function"!=typeof a?a:(b=(new Chunk).render(a,this),b instanceof Chunk?b.data.join(""):b)},Context.prototype.getTemplateName=function(){return this.templateName},Stub.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.callback(a.error),dust.log("Rendering failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.out+=a.data.join(""),a=a.next,this.head=a}this.callback(null,this.out)},Stream.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.emit("error",a.error),this.emit("end"),dust.log("Streaming failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.emit("data",a.data.join("")),a=a.next,this.head=a}this.emit("end")},Stream.prototype.emit=function(a,b){var c,d,e=this.events||{},f=e[a]||[];if(!f.length)return dust.log("Stream broadcasting, but no listeners for `"+a+"`",DEBUG),!1;for(f=f.slice(0),c=0,d=f.length;d>c;c++)f[c](b);return!0},Stream.prototype.on=function(a,b){var c=this.events=this.events||{},d=c[a]=c[a]||[];return"function"!=typeof b?dust.log("No callback function provided for `"+a+"` event listener",WARN):d.push(b),this},Stream.prototype.pipe=function(a){if("function"!=typeof a.write||"function"!=typeof a.end)return dust.log("Incompatible stream passed to `pipe`",WARN),this;var b=!1;return"function"==typeof a.emit&&a.emit("pipe",this),"function"==typeof a.on&&a.on("error",function(){b=!0}),this.on("data",function(c){if(!b)try{a.write(c,"utf8")}catch(d){dust.log(d,ERROR)}}).on("end",function(){if(!b)try{a.end(),b=!0}catch(c){dust.log(c,ERROR)}})},Chunk.prototype.write=function(a){var b=this.taps;return b&&(a=b.go(a)),this.data.push(a),this},Chunk.prototype.end=function(a){return a&&this.write(a),this.flushable=!0,this.root.flush(),this},Chunk.prototype.map=function(a){var b=new Chunk(this.root,this.next,this.taps),c=new Chunk(this.root,b,this.taps);this.next=c,this.flushable=!0;try{a(c)}catch(d){dust.log(d,ERROR),c.setError(d)}return b},Chunk.prototype.tap=function(a){var b=this.taps;return this.taps=b?b.push(a):new Tap(a),this},Chunk.prototype.untap=function(){return this.taps=this.taps.tail,this},Chunk.prototype.render=function(a,b){return a(this,b)},Chunk.prototype.reference=function(a,b,c,d){return"function"==typeof a?(a=a.apply(b.current(),[this,b,null,{auto:c,filters:d}]),a instanceof Chunk?a:this.reference(a,b,c,d)):dust.isThenable(a)?this.await(a,b,null,c,d):dust.isStreamable(a)?this.stream(a,b,null,c,d):dust.isEmpty(a)?this:this.write(dust.filter(a,c,d,b))},Chunk.prototype.section=function(a,b,c,d){var e,f,g,h=c.block,i=c["else"],j=this;if("function"==typeof a&&!dust.isTemplateFn(a)){try{a=a.apply(b.current(),[this,b,c,d])}catch(k){return dust.log(k,ERROR),this.setError(k)}if(a instanceof Chunk)return a}if(dust.isEmptyObject(c))return j;if(dust.isEmptyObject(d)||(b=b.push(d)),dust.isArray(a)){if(h){if(f=a.length,f>0){for(g=b.stack&&b.stack.head||{},g.$len=f,e=0;f>e;e++)g.$idx=e,j=h(j,b.push(a[e],e,f));return g.$idx=void 0,g.$len=void 0,j}if(i)return i(this,b)}}else{if(dust.isThenable(a))return this.await(a,b,c);if(dust.isStreamable(a))return this.stream(a,b,c);if(a===!0){if(h)return h(this,b)}else if(a||0===a){if(h)return h(this,b.push(a))}else if(i)return i(this,b)}return dust.log("Section without corresponding key in template `"+b.getTemplateName()+"`",DEBUG),this},Chunk.prototype.exists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(e)return e(this,b)}else{if(d)return d(this,b);dust.log("No block for exists check in template `"+b.getTemplateName()+"`",DEBUG)}return this},Chunk.prototype.notexists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(d)return d(this,b);dust.log("No block for not-exists check in template `"+b.getTemplateName()+"`",DEBUG)}else if(e)return e(this,b);return this},Chunk.prototype.block=function(a,b,c){var d=a||c.block;return d?d(this,b):this},Chunk.prototype.partial=function(a,b,c,d){var e;return void 0===d&&(d=c,c=b),dust.isEmptyObject(d)||(c=c.clone(),e=c.pop(),c=c.push(d).push(e)),dust.isTemplateFn(a)?this.capture(a,b,function(a,b){c.templateName=a,load(a,b,c).end()}):(c.templateName=a,load(a,this,c))},Chunk.prototype.helper=function(a,b,c,d,e){var f,g=this,h=d.filters;if(void 0===e&&(e="h"),!dust.helpers[a])return dust.log("Helper `"+a+"` does not exist",WARN),g;try{return f=dust.helpers[a](g,b,c,d),f instanceof Chunk?f:("string"==typeof h&&(h=h.split("|")),dust.isEmptyObject(c)?g.reference(f,b,e,h):g.section(f,b,c,d))}catch(i){return dust.log("Error in helper `"+a+"`: "+i.message,ERROR),g.setError(i)}},Chunk.prototype.await=function(a,b,c,d,e){return this.map(function(f){a.then(function(a){f=c?f.section(a,b,c):f.reference(a,b,d,e),f.end()},function(a){var d=c&&c.error;d?f.render(d,b.push(a)).end():(dust.log("Unhandled promise rejection in `"+b.getTemplateName()+"`",INFO),f.end())})})},Chunk.prototype.stream=function(a,b,c,d,e){var f=c&&c.block,g=c&&c.error;return this.map(function(h){var i=!1;a.on("data",function(a){i||(f?h=h.map(function(c){c.render(f,b.push(a)).end()}):c||(h=h.reference(a,b,d,e)))}).on("error",function(a){i||(g?h.render(g,b.push(a)):dust.log("Unhandled stream error in `"+b.getTemplateName()+"`",INFO),i||(i=!0,h.end()))}).on("end",function(){i||(i=!0,h.end())})})},Chunk.prototype.capture=function(a,b,c){return this.map(function(d){var e=new Stub(function(a,b){a?d.setError(a):c(b,d)});a(e.head,b).end()})},Chunk.prototype.setError=function(a){return this.error=a,this.root.flush(),this};for(var f in Chunk.prototype)dust._aliases[f]&&(Chunk.prototype[dust._aliases[f]]=Chunk.prototype[f]);Tap.prototype.push=function(a){return new Tap(a,this)},Tap.prototype.go=function(a){for(var b=this;b;)a=b.head(a),b=b.tail;return a};var HCHARS=/[&<>"']/,AMP=/&/g,LT=//g,QUOT=/\"/g,SQUOT=/\'/g;dust.escapeHtml=function(a){return"string"==typeof a||a&&"function"==typeof a.toString?("string"!=typeof a&&(a=a.toString()),HCHARS.test(a)?a.replace(AMP,"&").replace(LT,"<").replace(GT,">").replace(QUOT,""").replace(SQUOT,"'"):a):a};var BS=/\\/g,FS=/\//g,CR=/\r/g,LS=/\u2028/g,PS=/\u2029/g,NL=/\n/g,LF=/\f/g,SQ=/'/g,DQ=/"/g,TB=/\t/g;return dust.escapeJs=function(a){return"string"==typeof a?a.replace(BS,"\\\\").replace(FS,"\\/").replace(DQ,'\\"').replace(SQ,"\\'").replace(CR,"\\r").replace(LS,"\\u2028").replace(PS,"\\u2029").replace(NL,"\\n").replace(LF,"\\f").replace(TB,"\\t"):a},dust.escapeJSON=function(a){return JSON?JSON.stringify(a).replace(LS,"\\u2028").replace(PS,"\\u2029").replace(LT,"\\u003c"):(dust.log("JSON is undefined; could not escape `"+a+"`",WARN),a)},dust}),"function"==typeof define&&define.amd&&define.amd.dust===!0&&define(["require","dust.core"],function(require,dust){return dust.onLoad=function(a,b){require([a],function(){b()})},dust}); \ No newline at end of file +!function(a,b){"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.core",[],b):"object"==typeof exports?module.exports=b():a.dust=b()}(this,function(){function getTemplate(a,b){return a?"function"==typeof a&&a.template?a.template:dust.isTemplateFn(a)?a:b!==!1?dust.cache[a]:void 0:void 0}function load(a,b,c){if(!a)return b.setError(new Error("No template or template name provided to render"));var d=getTemplate(a,dust.config.cache);return d?d(b,Context.wrap(c,d.templateName)):dust.onLoad?b.map(function(b){function d(a,d){var f;if(a)return b.setError(a);if(f=getTemplate(d,!1)||getTemplate(e,dust.config.cache),!f){if(!dust.compile)return b.setError(new Error("Dust compiler not available"));f=dust.loadSource(dust.compile(d,e))}f(b,Context.wrap(c,f.templateName)).end()}var e=a;3===dust.onLoad.length?dust.onLoad(e,c.options,d):dust.onLoad(e,d)}):b.setError(new Error("Template Not Found: "+a))}function Context(a,b,c,d,e){void 0===a||a instanceof Stack||(a=new Stack(a)),this.stack=a,this.global=b,this.options=c,this.blocks=d,this.templateName=e,this._isContext=!0}function getWithResolvedData(a,b,c){return function(d){return a.push(d)._get(b,c)}}function Stack(a,b,c,d){this.tail=b,this.isObject=a&&"object"==typeof a,this.head=a,this.index=c,this.of=d}function Stub(a){this.head=new Chunk(this),this.callback=a,this.out=""}function Stream(){this.head=new Chunk(this)}function Chunk(a,b,c){this.root=a,this.next=b,this.data=[],this.flushable=!1,this.taps=c}function Tap(a,b){this.head=a,this.tail=b}var dust={version:"2.7.5"},NONE="NONE",ERROR="ERROR",WARN="WARN",INFO="INFO",DEBUG="DEBUG",EMPTY_FUNC=function(){};dust.config={whitespace:!1,amd:!1,cjs:!1,cache:!0},dust._aliases={write:"w",end:"e",map:"m",render:"r",reference:"f",section:"s",exists:"x",notexists:"nx",block:"b",partial:"p",helper:"h"},function(){var a,b,c={DEBUG:0,INFO:1,WARN:2,ERROR:3,NONE:4};"undefined"!=typeof console&&console.log?(a=console.log,b="function"==typeof a?function(){a.apply(console,arguments)}:function(){a(Array.prototype.slice.apply(arguments).join(" "))}):b=EMPTY_FUNC,dust.log=function(a,d){d=d||INFO,c[d]>=c[dust.debugLevel]&&b("[DUST:"+d+"]",a)},dust.debugLevel=NONE,"undefined"!=typeof process&&process.env&&/\bdust\b/.test(process.env.DEBUG)&&(dust.debugLevel=DEBUG)}(),dust.helpers={},dust.cache={},dust.register=function(a,b){a&&(b.templateName=a,dust.config.cache!==!1&&(dust.cache[a]=b))},dust.render=function(a,b,c){var d=new Stub(c).head;try{load(a,d,b).end()}catch(e){d.setError(e)}},dust.stream=function(a,b){var c=new Stream,d=c.head;return dust.nextTick(function(){try{load(a,d,b).end()}catch(c){d.setError(c)}}),c},dust.loadSource=function(source){return eval(source)},dust.isArray=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},dust.nextTick=function(){return function(a){setTimeout(a,0)}}(),dust.isEmpty=function(a){return 0===a?!1:dust.isArray(a)&&!a.length?!0:!a},dust.isEmptyObject=function(a){var b;if(null===a)return!1;if(void 0===a)return!1;if(a.length>0)return!1;for(b in a)if(Object.prototype.hasOwnProperty.call(a,b))return!1;return!0},dust.isTemplateFn=function(a){return"function"==typeof a&&a.__dustBody},dust.isThenable=function(a){return a&&"object"==typeof a&&"function"==typeof a.then},dust.isStreamable=function(a){return a&&"function"==typeof a.on&&"function"==typeof a.pipe},dust.filter=function(a,b,c,d){var e,f,g,h;if(c)for(e=0,f=c.length;f>e;e++)g=c[e],g.length&&(h=dust.filters[g],"s"===g?b=null:"function"==typeof h?a=h(a,d):dust.log("Invalid filter `"+g+"`",WARN));return b&&(a=dust.filters[b](a,d)),a},dust.filters={h:function(a){return dust.escapeHtml(a)},j:function(a){return dust.escapeJs(a)},u:encodeURI,uc:encodeURIComponent,js:function(a){return dust.escapeJSON(a)},jp:function(a){return JSON?JSON.parse(a):(dust.log("JSON is undefined; could not parse `"+a+"`",WARN),a)}},dust.makeBase=dust.context=function(a,b){return new Context(void 0,a,b)},dust.isContext=function(a){return"object"==typeof a&&a._isContext===!0},Context.wrap=function(a,b){return dust.isContext(a)?a:new Context(a,{},{},null,b)},Context.prototype.get=function(a,b){return"string"==typeof a&&("."===a[0]&&(b=!0,a=a.substr(1)),a=a.split(".")),this._get(b,a)},Context.prototype._get=function(a,b){var c,d,e,f,g,h=this.stack||{},i=1;if(d=b[0],e=b.length,a&&0===e)f=h,h=h.head;else{if(a)h&&(h=h.head?h.head[d]:void 0);else{for(;h&&(!h.isObject||(f=h.head,c=h.head[d],void 0===c));)h=h.tail;h=void 0!==c?c:this.global&&this.global[d]}for(;h&&e>i;){if(dust.isThenable(h))return h.then(getWithResolvedData(this,a,b.slice(i)));f=h,h=h[b[i]],i++}}return"function"==typeof h?(g=function(){try{return h.apply(f,arguments)}catch(a){throw dust.log(a,ERROR),a}},g.__dustBody=!!h.__dustBody,g):(void 0===h&&dust.log("Cannot find reference `{"+b.join(".")+"}` in template `"+this.getTemplateName()+"`",INFO),h)},Context.prototype.getPath=function(a,b){return this._get(a,b)},Context.prototype.push=function(a,b,c){return void 0===a?(dust.log("Not pushing an undefined variable onto the context",INFO),this):this.rebase(new Stack(a,this.stack,b,c))},Context.prototype.pop=function(){var a=this.current();return this.stack=this.stack&&this.stack.tail,a},Context.prototype.rebase=function(a){return new Context(a,this.global,this.options,this.blocks,this.getTemplateName())},Context.prototype.clone=function(){var a=this.rebase();return a.stack=this.stack,a},Context.prototype.current=function(){return this.stack&&this.stack.head},Context.prototype.getBlock=function(a){var b,c,d;if("function"==typeof a&&(a=a(new Chunk,this).data.join("")),b=this.blocks,!b)return dust.log("No blocks for context `"+a+"` in template `"+this.getTemplateName()+"`",DEBUG),!1;for(c=b.length;c--;)if(d=b[c][a])return d;return dust.log("Malformed template `"+this.getTemplateName()+"` was missing one or more blocks."),!1},Context.prototype.shiftBlocks=function(a){var b,c=this.blocks;return a?(b=c?c.concat([a]):[a],new Context(this.stack,this.global,this.options,b,this.getTemplateName())):this},Context.prototype.resolve=function(a){var b;return"function"!=typeof a?a:(b=(new Chunk).render(a,this),b instanceof Chunk?b.data.join(""):b)},Context.prototype.getTemplateName=function(){return this.templateName},Stub.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.callback(a.error),dust.log("Rendering failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.out+=a.data.join(""),a=a.next,this.head=a}this.callback(null,this.out)},Stream.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.emit("error",a.error),this.emit("end"),dust.log("Streaming failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.emit("data",a.data.join("")),a=a.next,this.head=a}this.emit("end")},Stream.prototype.emit=function(a,b){var c,d,e=this.events||{},f=e[a]||[];if(!f.length)return dust.log("Stream broadcasting, but no listeners for `"+a+"`",DEBUG),!1;for(f=f.slice(0),c=0,d=f.length;d>c;c++)f[c](b);return!0},Stream.prototype.on=function(a,b){var c=this.events=this.events||{},d=c[a]=c[a]||[];return"function"!=typeof b?dust.log("No callback function provided for `"+a+"` event listener",WARN):d.push(b),this},Stream.prototype.pipe=function(a){if("function"!=typeof a.write||"function"!=typeof a.end)return dust.log("Incompatible stream passed to `pipe`",WARN),this;var b=!1;return"function"==typeof a.emit&&a.emit("pipe",this),"function"==typeof a.on&&a.on("error",function(){b=!0}),this.on("data",function(c){if(!b)try{a.write(c,"utf8")}catch(d){dust.log(d,ERROR)}}).on("end",function(){if(!b)try{a.end(),b=!0}catch(c){dust.log(c,ERROR)}})},Chunk.prototype.write=function(a){var b=this.taps;return b&&(a=b.go(a)),this.data.push(a),this},Chunk.prototype.end=function(a){return a&&this.write(a),this.flushable=!0,this.root.flush(),this},Chunk.prototype.map=function(a){var b=new Chunk(this.root,this.next,this.taps),c=new Chunk(this.root,b,this.taps);this.next=c,this.flushable=!0;try{a(c)}catch(d){dust.log(d,ERROR),c.setError(d)}return b},Chunk.prototype.tap=function(a){var b=this.taps;return this.taps=b?b.push(a):new Tap(a),this},Chunk.prototype.untap=function(){return this.taps=this.taps.tail,this},Chunk.prototype.render=function(a,b){return a(this,b)},Chunk.prototype.reference=function(a,b,c,d){return"function"==typeof a?(a=a.apply(b.current(),[this,b,null,{auto:c,filters:d}]),a instanceof Chunk?a:this.reference(a,b,c,d)):dust.isThenable(a)?this.await(a,b,null,c,d):dust.isStreamable(a)?this.stream(a,b,null,c,d):dust.isEmpty(a)?this:this.write(dust.filter(a,c,d,b))},Chunk.prototype.section=function(a,b,c,d){var e,f,g,h=c.block,i=c["else"],j=this;if("function"==typeof a&&!dust.isTemplateFn(a)){try{a=a.apply(b.current(),[this,b,c,d])}catch(k){return dust.log(k,ERROR),this.setError(k)}if(a instanceof Chunk)return a}if(dust.isEmptyObject(c))return j;if(dust.isEmptyObject(d)||(b=b.push(d)),dust.isArray(a)){if(h){if(f=a.length,f>0){for(g=b.stack&&b.stack.head||{},g.$len=f,e=0;f>e;e++)g.$idx=e,j=h(j,b.push(a[e],e,f));return g.$idx=void 0,g.$len=void 0,j}if(i)return i(this,b)}}else{if(dust.isThenable(a))return this.await(a,b,c);if(dust.isStreamable(a))return this.stream(a,b,c);if(a===!0){if(h)return h(this,b)}else if(a||0===a){if(h)return h(this,b.push(a))}else if(i)return i(this,b)}return dust.log("Section without corresponding key in template `"+b.getTemplateName()+"`",DEBUG),this},Chunk.prototype.exists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(e)return e(this,b)}else{if(d)return d(this,b);dust.log("No block for exists check in template `"+b.getTemplateName()+"`",DEBUG)}return this},Chunk.prototype.notexists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(d)return d(this,b);dust.log("No block for not-exists check in template `"+b.getTemplateName()+"`",DEBUG)}else if(e)return e(this,b);return this},Chunk.prototype.block=function(a,b,c){var d=a||c.block;return d?d(this,b):this},Chunk.prototype.partial=function(a,b,c,d){var e;return void 0===d&&(d=c,c=b),dust.isEmptyObject(d)||(c=c.clone(),e=c.pop(),c=c.push(d).push(e)),dust.isTemplateFn(a)?this.capture(a,b,function(a,b){c.templateName=a,load(a,b,c).end()}):(c.templateName=a,load(a,this,c))},Chunk.prototype.helper=function(a,b,c,d,e){var f,g=this,h=d.filters;if(void 0===e&&(e="h"),!dust.helpers[a])return dust.log("Helper `"+a+"` does not exist",WARN),g;try{return f=dust.helpers[a](g,b,c,d),f instanceof Chunk?f:("string"==typeof h&&(h=h.split("|")),dust.isEmptyObject(c)?g.reference(f,b,e,h):g.section(f,b,c,d))}catch(i){return dust.log("Error in helper `"+a+"`: "+i.message,ERROR),g.setError(i)}},Chunk.prototype.await=function(a,b,c,d,e){return this.map(function(f){a.then(function(a){f=c?f.section(a,b,c):f.reference(a,b,d,e),f.end()},function(a){var d=c&&c.error;d?f.render(d,b.push(a)).end():(dust.log("Unhandled promise rejection in `"+b.getTemplateName()+"`",INFO),f.end())})})},Chunk.prototype.stream=function(a,b,c,d,e){var f=c&&c.block,g=c&&c.error;return this.map(function(h){var i=!1;a.on("data",function(a){i||(f?h=h.map(function(c){c.render(f,b.push(a)).end()}):c||(h=h.reference(a,b,d,e)))}).on("error",function(a){i||(g?h.render(g,b.push(a)):dust.log("Unhandled stream error in `"+b.getTemplateName()+"`",INFO),i||(i=!0,h.end()))}).on("end",function(){i||(i=!0,h.end())})})},Chunk.prototype.capture=function(a,b,c){return this.map(function(d){var e=new Stub(function(a,b){a?d.setError(a):c(b,d)});a(e.head,b).end()})},Chunk.prototype.setError=function(a){return this.error=a,this.root.flush(),this};for(var f in Chunk.prototype)dust._aliases[f]&&(Chunk.prototype[dust._aliases[f]]=Chunk.prototype[f]);Tap.prototype.push=function(a){return new Tap(a,this)},Tap.prototype.go=function(a){for(var b=this;b;)a=b.head(a),b=b.tail;return a};var HCHARS=/[&<>"']/,AMP=/&/g,LT=//g,QUOT=/\"/g,SQUOT=/\'/g;dust.escapeHtml=function(a){return"string"==typeof a||a&&"function"==typeof a.toString?("string"!=typeof a&&(a=a.toString()),HCHARS.test(a)?a.replace(AMP,"&").replace(LT,"<").replace(GT,">").replace(QUOT,""").replace(SQUOT,"'"):a):a};var BS=/\\/g,FS=/\//g,CR=/\r/g,LS=/\u2028/g,PS=/\u2029/g,NL=/\n/g,LF=/\f/g,SQ=/'/g,DQ=/"/g,TB=/\t/g;return dust.escapeJs=function(a){return"string"==typeof a?a.replace(BS,"\\\\").replace(FS,"\\/").replace(DQ,'\\"').replace(SQ,"\\'").replace(CR,"\\r").replace(LS,"\\u2028").replace(PS,"\\u2029").replace(NL,"\\n").replace(LF,"\\f").replace(TB,"\\t"):a},dust.escapeJSON=function(a){return JSON?JSON.stringify(a).replace(LS,"\\u2028").replace(PS,"\\u2029").replace(LT,"\\u003c"):(dust.log("JSON is undefined; could not escape `"+a+"`",WARN),a)},dust}),"function"==typeof define&&define.amd&&define.amd.dust===!0&&define(["require","dust.core"],function(require,dust){return dust.onLoad=function(a,b){require([a],function(){b()})},dust}); \ No newline at end of file diff --git a/dist/dust-full.js b/dist/dust-full.js index 5413e6ab..37b9f027 100644 --- a/dist/dust-full.js +++ b/dist/dust-full.js @@ -1,4 +1,4 @@ -/*! dustjs-linkedin - v2.7.4 +/*! dustjs-linkedin - v2.7.5 * http://dustjs.com/ * Copyright (c) 2016 Aleksander Williams; Released under the MIT License */ (function (root, factory) { @@ -11,7 +11,7 @@ } }(this, function() { var dust = { - "version": "2.7.4" + "version": "2.7.5" }, NONE = 'NONE', ERROR = 'ERROR', WARN = 'WARN', INFO = 'INFO', DEBUG = 'DEBUG', EMPTY_FUNC = function() {}; diff --git a/dist/dust-full.min.js b/dist/dust-full.min.js index 3d82df5f..8f857440 100644 --- a/dist/dust-full.min.js +++ b/dist/dust-full.min.js @@ -1,5 +1,5 @@ -/*! dustjs-linkedin - v2.7.4 +/*! dustjs-linkedin - v2.7.5 * http://dustjs.com/ * Copyright (c) 2016 Aleksander Williams; Released under the MIT License */ -!function(a,b){"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.core",[],b):"object"==typeof exports?module.exports=b():a.dust=b()}(this,function(){function getTemplate(a,b){return a?"function"==typeof a&&a.template?a.template:dust.isTemplateFn(a)?a:b!==!1?dust.cache[a]:void 0:void 0}function load(a,b,c){if(!a)return b.setError(new Error("No template or template name provided to render"));var d=getTemplate(a,dust.config.cache);return d?d(b,Context.wrap(c,d.templateName)):dust.onLoad?b.map(function(b){function d(a,d){var f;if(a)return b.setError(a);if(f=getTemplate(d,!1)||getTemplate(e,dust.config.cache),!f){if(!dust.compile)return b.setError(new Error("Dust compiler not available"));f=dust.loadSource(dust.compile(d,e))}f(b,Context.wrap(c,f.templateName)).end()}var e=a;3===dust.onLoad.length?dust.onLoad(e,c.options,d):dust.onLoad(e,d)}):b.setError(new Error("Template Not Found: "+a))}function Context(a,b,c,d,e){void 0===a||a instanceof Stack||(a=new Stack(a)),this.stack=a,this.global=b,this.options=c,this.blocks=d,this.templateName=e,this._isContext=!0}function getWithResolvedData(a,b,c){return function(d){return a.push(d)._get(b,c)}}function Stack(a,b,c,d){this.tail=b,this.isObject=a&&"object"==typeof a,this.head=a,this.index=c,this.of=d}function Stub(a){this.head=new Chunk(this),this.callback=a,this.out=""}function Stream(){this.head=new Chunk(this)}function Chunk(a,b,c){this.root=a,this.next=b,this.data=[],this.flushable=!1,this.taps=c}function Tap(a,b){this.head=a,this.tail=b}var dust={version:"2.7.4"},NONE="NONE",ERROR="ERROR",WARN="WARN",INFO="INFO",DEBUG="DEBUG",EMPTY_FUNC=function(){};dust.config={whitespace:!1,amd:!1,cjs:!1,cache:!0},dust._aliases={write:"w",end:"e",map:"m",render:"r",reference:"f",section:"s",exists:"x",notexists:"nx",block:"b",partial:"p",helper:"h"},function(){var a,b,c={DEBUG:0,INFO:1,WARN:2,ERROR:3,NONE:4};"undefined"!=typeof console&&console.log?(a=console.log,b="function"==typeof a?function(){a.apply(console,arguments)}:function(){a(Array.prototype.slice.apply(arguments).join(" "))}):b=EMPTY_FUNC,dust.log=function(a,d){d=d||INFO,c[d]>=c[dust.debugLevel]&&b("[DUST:"+d+"]",a)},dust.debugLevel=NONE,"undefined"!=typeof process&&process.env&&/\bdust\b/.test(process.env.DEBUG)&&(dust.debugLevel=DEBUG)}(),dust.helpers={},dust.cache={},dust.register=function(a,b){a&&(b.templateName=a,dust.config.cache!==!1&&(dust.cache[a]=b))},dust.render=function(a,b,c){var d=new Stub(c).head;try{load(a,d,b).end()}catch(e){d.setError(e)}},dust.stream=function(a,b){var c=new Stream,d=c.head;return dust.nextTick(function(){try{load(a,d,b).end()}catch(c){d.setError(c)}}),c},dust.loadSource=function(source){return eval(source)},dust.isArray=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},dust.nextTick=function(){return function(a){setTimeout(a,0)}}(),dust.isEmpty=function(a){return 0===a?!1:dust.isArray(a)&&!a.length?!0:!a},dust.isEmptyObject=function(a){var b;if(null===a)return!1;if(void 0===a)return!1;if(a.length>0)return!1;for(b in a)if(Object.prototype.hasOwnProperty.call(a,b))return!1;return!0},dust.isTemplateFn=function(a){return"function"==typeof a&&a.__dustBody},dust.isThenable=function(a){return a&&"object"==typeof a&&"function"==typeof a.then},dust.isStreamable=function(a){return a&&"function"==typeof a.on&&"function"==typeof a.pipe},dust.filter=function(a,b,c,d){var e,f,g,h;if(c)for(e=0,f=c.length;f>e;e++)g=c[e],g.length&&(h=dust.filters[g],"s"===g?b=null:"function"==typeof h?a=h(a,d):dust.log("Invalid filter `"+g+"`",WARN));return b&&(a=dust.filters[b](a,d)),a},dust.filters={h:function(a){return dust.escapeHtml(a)},j:function(a){return dust.escapeJs(a)},u:encodeURI,uc:encodeURIComponent,js:function(a){return dust.escapeJSON(a)},jp:function(a){return JSON?JSON.parse(a):(dust.log("JSON is undefined; could not parse `"+a+"`",WARN),a)}},dust.makeBase=dust.context=function(a,b){return new Context(void 0,a,b)},dust.isContext=function(a){return"object"==typeof a&&a._isContext===!0},Context.wrap=function(a,b){return dust.isContext(a)?a:new Context(a,{},{},null,b)},Context.prototype.get=function(a,b){return"string"==typeof a&&("."===a[0]&&(b=!0,a=a.substr(1)),a=a.split(".")),this._get(b,a)},Context.prototype._get=function(a,b){var c,d,e,f,g,h=this.stack||{},i=1;if(d=b[0],e=b.length,a&&0===e)f=h,h=h.head;else{if(a)h&&(h=h.head?h.head[d]:void 0);else{for(;h&&(!h.isObject||(f=h.head,c=h.head[d],void 0===c));)h=h.tail;h=void 0!==c?c:this.global&&this.global[d]}for(;h&&e>i;){if(dust.isThenable(h))return h.then(getWithResolvedData(this,a,b.slice(i)));f=h,h=h[b[i]],i++}}return"function"==typeof h?(g=function(){try{return h.apply(f,arguments)}catch(a){throw dust.log(a,ERROR),a}},g.__dustBody=!!h.__dustBody,g):(void 0===h&&dust.log("Cannot find reference `{"+b.join(".")+"}` in template `"+this.getTemplateName()+"`",INFO),h)},Context.prototype.getPath=function(a,b){return this._get(a,b)},Context.prototype.push=function(a,b,c){return void 0===a?(dust.log("Not pushing an undefined variable onto the context",INFO),this):this.rebase(new Stack(a,this.stack,b,c))},Context.prototype.pop=function(){var a=this.current();return this.stack=this.stack&&this.stack.tail,a},Context.prototype.rebase=function(a){return new Context(a,this.global,this.options,this.blocks,this.getTemplateName())},Context.prototype.clone=function(){var a=this.rebase();return a.stack=this.stack,a},Context.prototype.current=function(){return this.stack&&this.stack.head},Context.prototype.getBlock=function(a){var b,c,d;if("function"==typeof a&&(a=a(new Chunk,this).data.join("")),b=this.blocks,!b)return dust.log("No blocks for context `"+a+"` in template `"+this.getTemplateName()+"`",DEBUG),!1;for(c=b.length;c--;)if(d=b[c][a])return d;return dust.log("Malformed template `"+this.getTemplateName()+"` was missing one or more blocks."),!1},Context.prototype.shiftBlocks=function(a){var b,c=this.blocks;return a?(b=c?c.concat([a]):[a],new Context(this.stack,this.global,this.options,b,this.getTemplateName())):this},Context.prototype.resolve=function(a){var b;return"function"!=typeof a?a:(b=(new Chunk).render(a,this),b instanceof Chunk?b.data.join(""):b)},Context.prototype.getTemplateName=function(){return this.templateName},Stub.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.callback(a.error),dust.log("Rendering failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.out+=a.data.join(""),a=a.next,this.head=a}this.callback(null,this.out)},Stream.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.emit("error",a.error),this.emit("end"),dust.log("Streaming failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.emit("data",a.data.join("")),a=a.next,this.head=a}this.emit("end")},Stream.prototype.emit=function(a,b){var c,d,e=this.events||{},f=e[a]||[];if(!f.length)return dust.log("Stream broadcasting, but no listeners for `"+a+"`",DEBUG),!1;for(f=f.slice(0),c=0,d=f.length;d>c;c++)f[c](b);return!0},Stream.prototype.on=function(a,b){var c=this.events=this.events||{},d=c[a]=c[a]||[];return"function"!=typeof b?dust.log("No callback function provided for `"+a+"` event listener",WARN):d.push(b),this},Stream.prototype.pipe=function(a){if("function"!=typeof a.write||"function"!=typeof a.end)return dust.log("Incompatible stream passed to `pipe`",WARN),this;var b=!1;return"function"==typeof a.emit&&a.emit("pipe",this),"function"==typeof a.on&&a.on("error",function(){b=!0}),this.on("data",function(c){if(!b)try{a.write(c,"utf8")}catch(d){dust.log(d,ERROR)}}).on("end",function(){if(!b)try{a.end(),b=!0}catch(c){dust.log(c,ERROR)}})},Chunk.prototype.write=function(a){var b=this.taps;return b&&(a=b.go(a)),this.data.push(a),this},Chunk.prototype.end=function(a){return a&&this.write(a),this.flushable=!0,this.root.flush(),this},Chunk.prototype.map=function(a){var b=new Chunk(this.root,this.next,this.taps),c=new Chunk(this.root,b,this.taps);this.next=c,this.flushable=!0;try{a(c)}catch(d){dust.log(d,ERROR),c.setError(d)}return b},Chunk.prototype.tap=function(a){var b=this.taps;return this.taps=b?b.push(a):new Tap(a),this},Chunk.prototype.untap=function(){return this.taps=this.taps.tail,this},Chunk.prototype.render=function(a,b){return a(this,b)},Chunk.prototype.reference=function(a,b,c,d){return"function"==typeof a?(a=a.apply(b.current(),[this,b,null,{auto:c,filters:d}]),a instanceof Chunk?a:this.reference(a,b,c,d)):dust.isThenable(a)?this.await(a,b,null,c,d):dust.isStreamable(a)?this.stream(a,b,null,c,d):dust.isEmpty(a)?this:this.write(dust.filter(a,c,d,b))},Chunk.prototype.section=function(a,b,c,d){var e,f,g,h=c.block,i=c["else"],j=this;if("function"==typeof a&&!dust.isTemplateFn(a)){try{a=a.apply(b.current(),[this,b,c,d])}catch(k){return dust.log(k,ERROR),this.setError(k)}if(a instanceof Chunk)return a}if(dust.isEmptyObject(c))return j;if(dust.isEmptyObject(d)||(b=b.push(d)),dust.isArray(a)){if(h){if(f=a.length,f>0){for(g=b.stack&&b.stack.head||{},g.$len=f,e=0;f>e;e++)g.$idx=e,j=h(j,b.push(a[e],e,f));return g.$idx=void 0,g.$len=void 0,j}if(i)return i(this,b)}}else{if(dust.isThenable(a))return this.await(a,b,c);if(dust.isStreamable(a))return this.stream(a,b,c);if(a===!0){if(h)return h(this,b)}else if(a||0===a){if(h)return h(this,b.push(a))}else if(i)return i(this,b)}return dust.log("Section without corresponding key in template `"+b.getTemplateName()+"`",DEBUG),this},Chunk.prototype.exists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(e)return e(this,b)}else{if(d)return d(this,b);dust.log("No block for exists check in template `"+b.getTemplateName()+"`",DEBUG)}return this},Chunk.prototype.notexists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(d)return d(this,b);dust.log("No block for not-exists check in template `"+b.getTemplateName()+"`",DEBUG)}else if(e)return e(this,b);return this},Chunk.prototype.block=function(a,b,c){var d=a||c.block;return d?d(this,b):this},Chunk.prototype.partial=function(a,b,c,d){var e;return void 0===d&&(d=c,c=b),dust.isEmptyObject(d)||(c=c.clone(),e=c.pop(),c=c.push(d).push(e)),dust.isTemplateFn(a)?this.capture(a,b,function(a,b){c.templateName=a,load(a,b,c).end()}):(c.templateName=a,load(a,this,c))},Chunk.prototype.helper=function(a,b,c,d,e){var f,g=this,h=d.filters;if(void 0===e&&(e="h"),!dust.helpers[a])return dust.log("Helper `"+a+"` does not exist",WARN),g;try{return f=dust.helpers[a](g,b,c,d),f instanceof Chunk?f:("string"==typeof h&&(h=h.split("|")),dust.isEmptyObject(c)?g.reference(f,b,e,h):g.section(f,b,c,d))}catch(i){return dust.log("Error in helper `"+a+"`: "+i.message,ERROR),g.setError(i)}},Chunk.prototype.await=function(a,b,c,d,e){return this.map(function(f){a.then(function(a){f=c?f.section(a,b,c):f.reference(a,b,d,e),f.end()},function(a){var d=c&&c.error;d?f.render(d,b.push(a)).end():(dust.log("Unhandled promise rejection in `"+b.getTemplateName()+"`",INFO),f.end())})})},Chunk.prototype.stream=function(a,b,c,d,e){var f=c&&c.block,g=c&&c.error;return this.map(function(h){var i=!1;a.on("data",function(a){i||(f?h=h.map(function(c){c.render(f,b.push(a)).end()}):c||(h=h.reference(a,b,d,e)))}).on("error",function(a){i||(g?h.render(g,b.push(a)):dust.log("Unhandled stream error in `"+b.getTemplateName()+"`",INFO),i||(i=!0,h.end()))}).on("end",function(){i||(i=!0,h.end())})})},Chunk.prototype.capture=function(a,b,c){return this.map(function(d){var e=new Stub(function(a,b){a?d.setError(a):c(b,d)});a(e.head,b).end()})},Chunk.prototype.setError=function(a){return this.error=a,this.root.flush(),this};for(var f in Chunk.prototype)dust._aliases[f]&&(Chunk.prototype[dust._aliases[f]]=Chunk.prototype[f]);Tap.prototype.push=function(a){return new Tap(a,this)},Tap.prototype.go=function(a){for(var b=this;b;)a=b.head(a),b=b.tail;return a};var HCHARS=/[&<>"']/,AMP=/&/g,LT=//g,QUOT=/\"/g,SQUOT=/\'/g;dust.escapeHtml=function(a){return"string"==typeof a||a&&"function"==typeof a.toString?("string"!=typeof a&&(a=a.toString()),HCHARS.test(a)?a.replace(AMP,"&").replace(LT,"<").replace(GT,">").replace(QUOT,""").replace(SQUOT,"'"):a):a};var BS=/\\/g,FS=/\//g,CR=/\r/g,LS=/\u2028/g,PS=/\u2029/g,NL=/\n/g,LF=/\f/g,SQ=/'/g,DQ=/"/g,TB=/\t/g;return dust.escapeJs=function(a){return"string"==typeof a?a.replace(BS,"\\\\").replace(FS,"\\/").replace(DQ,'\\"').replace(SQ,"\\'").replace(CR,"\\r").replace(LS,"\\u2028").replace(PS,"\\u2029").replace(NL,"\\n").replace(LF,"\\f").replace(TB,"\\t"):a},dust.escapeJSON=function(a){return JSON?JSON.stringify(a).replace(LS,"\\u2028").replace(PS,"\\u2029").replace(LT,"\\u003c"):(dust.log("JSON is undefined; could not escape `"+a+"`",WARN),a)},dust}),function(a,b){"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.parse",["dust.core"],function(dust){return b(dust).parse}):"object"==typeof exports?module.exports=b(require("./dust")):b(a.dust)}(this,function(dust){var a=function(){function a(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}function b(a,b,c,d,e,f){this.message=a,this.expected=b,this.found=c,this.offset=d,this.line=e,this.column=f,this.name="SyntaxError"}function c(a){function c(){return f(wc).line}function d(){return f(wc).column}function e(a){throw h(a,null,wc)}function f(b){function c(b,c,d){var e,f;for(e=c;d>e;e++)f=a.charAt(e),"\n"===f?(b.seenCR||b.line++,b.column=1,b.seenCR=!1):"\r"===f||"\u2028"===f||"\u2029"===f?(b.line++,b.column=1,b.seenCR=!0):(b.column++,b.seenCR=!1)}return xc!==b&&(xc>b&&(xc=0,yc={line:1,column:1,seenCR:!1}),c(yc,xc,b),xc=b),yc}function g(a){zc>vc||(vc>zc&&(zc=vc,Ac=[]),Ac.push(a))}function h(c,d,e){function g(a){var b=1;for(a.sort(function(a,b){return a.descriptionb.description?1:0});b1?g.slice(0,-1).join(", ")+" or "+g[a.length-1]:g[0],e=b?'"'+c(b)+'"':"end of input","Expected "+d+" but "+e+" found."}var i=f(e),j=evc?(j=a.charAt(vc),vc++):(j=X,0===Bc&&g(Eb)),j!==X?(wc=d,e=Fb(j),d=e):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa),d!==X)for(;d!==X;)c.push(d),d=vc,e=vc,Bc++,f=M(),Bc--,f===X?e=da:(vc=e,e=aa),e!==X?(f=vc,Bc++,h=K(),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(h=vc,Bc++,i=L(),Bc--,i===X?h=da:(vc=h,h=aa),h!==X?(i=vc,Bc++,j=R(),Bc--,j===X?i=da:(vc=i,i=aa),i!==X?(a.length>vc?(j=a.charAt(vc),vc++):(j=X,0===Bc&&g(Eb)),j!==X?(wc=d,e=Fb(j),d=e):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa);else c=aa;c!==X&&(wc=b,c=Gb(c)),b=c}return Bc--,b===X&&(c=X,0===Bc&&g(Cb)),b}function I(){var b,c,d,e,f;if(Bc++,b=vc,c=[],d=vc,e=vc,Bc++,f=M(),Bc--,f===X?e=da:(vc=e,e=aa),e!==X?(f=J(),f===X&&(Ib.test(a.charAt(vc))?(f=a.charAt(vc),vc++):(f=X,0===Bc&&g(Jb))),f!==X?(wc=d,e=Fb(f),d=e):(vc=d,d=aa)):(vc=d,d=aa),d!==X)for(;d!==X;)c.push(d),d=vc,e=vc,Bc++,f=M(),Bc--,f===X?e=da:(vc=e,e=aa),e!==X?(f=J(),f===X&&(Ib.test(a.charAt(vc))?(f=a.charAt(vc),vc++):(f=X,0===Bc&&g(Jb))),f!==X?(wc=d,e=Fb(f),d=e):(vc=d,d=aa)):(vc=d,d=aa);else c=aa;return c!==X&&(wc=b,c=Kb(c)),b=c,Bc--,b===X&&(c=X,0===Bc&&g(Hb)),b}function J(){var b,c;return b=vc,a.substr(vc,2)===Lb?(c=Lb,vc+=2):(c=X,0===Bc&&g(Mb)),c!==X&&(wc=b,c=Nb()),b=c}function K(){var b,c,d,e,f,h;if(Bc++,b=vc,a.substr(vc,2)===Pb?(c=Pb,vc+=2):(c=X,0===Bc&&g(Qb)),c!==X){for(d=[],e=vc,f=vc,Bc++,a.substr(vc,2)===Rb?(h=Rb,vc+=2):(h=X,0===Bc&&g(Sb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Tb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);e!==X;)d.push(e),e=vc,f=vc,Bc++,a.substr(vc,2)===Rb?(h=Rb,vc+=2):(h=X,0===Bc&&g(Sb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Tb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);d!==X?(a.substr(vc,2)===Rb?(e=Rb,vc+=2):(e=X,0===Bc&&g(Sb)),e!==X?(wc=b,c=Ub(d),b=c):(vc=b,b=aa)):(vc=b,b=aa)}else vc=b,b=aa;return Bc--,b===X&&(c=X,0===Bc&&g(Ob)),b}function L(){var b,c,d,e,f,h;if(Bc++,b=vc,a.substr(vc,2)===Wb?(c=Wb,vc+=2):(c=X,0===Bc&&g(Xb)),c!==X){for(d=[],e=vc,f=vc,Bc++,a.substr(vc,2)===Yb?(h=Yb,vc+=2):(h=X,0===Bc&&g(Zb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Fb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);e!==X;)d.push(e),e=vc,f=vc,Bc++,a.substr(vc,2)===Yb?(h=Yb,vc+=2):(h=X,0===Bc&&g(Zb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Fb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);d!==X?(a.substr(vc,2)===Yb?(e=Yb,vc+=2):(e=X,0===Bc&&g(Zb)),e!==X?(wc=b,c=$b(d),b=c):(vc=b,b=aa)):(vc=b,b=aa)}else vc=b,b=aa;return Bc--,b===X&&(c=X,0===Bc&&g(Vb)),b}function M(){var b,c,d,e,f,h,i,j,k,l;if(b=vc,c=N(),c!==X){for(d=[],e=S();e!==X;)d.push(e),e=S();if(d!==X)if(_b.test(a.charAt(vc))?(e=a.charAt(vc),vc++):(e=X,0===Bc&&g(ac)),e!==X){for(f=[],h=S();h!==X;)f.push(h),h=S();if(f!==X){if(h=[],i=vc,j=vc,Bc++,k=O(),Bc--,k===X?j=da:(vc=j,j=aa),j!==X?(k=vc,Bc++,l=R(),Bc--,l===X?k=da:(vc=k,k=aa),k!==X?(a.length>vc?(l=a.charAt(vc),vc++):(l=X,0===Bc&&g(Eb)),l!==X?(j=[j,k,l],i=j):(vc=i,i=aa)):(vc=i,i=aa)):(vc=i,i=aa),i!==X)for(;i!==X;)h.push(i),i=vc,j=vc,Bc++,k=O(),Bc--,k===X?j=da:(vc=j,j=aa),j!==X?(k=vc,Bc++,l=R(),Bc--,l===X?k=da:(vc=k,k=aa),k!==X?(a.length>vc?(l=a.charAt(vc),vc++):(l=X,0===Bc&&g(Eb)),l!==X?(j=[j,k,l],i=j):(vc=i,i=aa)):(vc=i,i=aa)):(vc=i,i=aa);else h=aa;if(h!==X){for(i=[],j=S();j!==X;)i.push(j),j=S();i!==X?(j=O(),j!==X?(c=[c,d,e,f,h,i,j],b=c):(vc=b,b=aa)):(vc=b,b=aa)}else vc=b,b=aa}else vc=b,b=aa}else vc=b,b=aa;else vc=b,b=aa}else vc=b,b=aa;return b===X&&(b=r()),b}function N(){var b;return 123===a.charCodeAt(vc)?(b=bc,vc++):(b=X,0===Bc&&g(cc)),b}function O(){var b;return 125===a.charCodeAt(vc)?(b=dc,vc++):(b=X,0===Bc&&g(ec)),b}function P(){var b;return 91===a.charCodeAt(vc)?(b=fc,vc++):(b=X,0===Bc&&g(gc)),b}function Q(){var b;return 93===a.charCodeAt(vc)?(b=hc,vc++):(b=X,0===Bc&&g(ic)),b}function R(){var b;return 10===a.charCodeAt(vc)?(b=jc,vc++):(b=X,0===Bc&&g(kc)),b===X&&(a.substr(vc,2)===lc?(b=lc,vc+=2):(b=X,0===Bc&&g(mc)),b===X&&(13===a.charCodeAt(vc)?(b=nc,vc++):(b=X,0===Bc&&g(oc)),b===X&&(8232===a.charCodeAt(vc)?(b=pc,vc++):(b=X,0===Bc&&g(qc)),b===X&&(8233===a.charCodeAt(vc)?(b=rc,vc++):(b=X,0===Bc&&g(sc)))))),b}function S(){var b;return tc.test(a.charAt(vc))?(b=a.charAt(vc),vc++):(b=X,0===Bc&&g(uc)),b===X&&(b=R()),b}function T(a){return parseInt(a.join(""),10)}function U(a){return a.concat([["line",c()],["col",d()]])}var V,W=arguments.length>1?arguments[1]:{},X={},Y={start:i},Z=i,$=function(a){var b=["body"].concat(a);return U(b)},_={type:"other",description:"section"},aa=X,ba=null,ca=function(a,b,c,d){return d&&a[1].text===d.text||e("Expected end tag for "+a[1].text+" but it was not found."),!0},da=void 0,ea=function(a,b,c){return c.push(["param",["literal","block"],b]),a.push(c,["filters"]),U(a)},fa="/",ga={type:"literal",value:"/",description:'"/"'},ha=function(a){return a.push(["bodies"],["filters"]),U(a)},ia=/^[#?\^<+@%]/,ja={type:"class",value:"[#?\\^<+@%]",description:"[#?\\^<+@%]"},ka=function(a,b,c,d){return[a,b,c,d]},la={type:"other",description:"end tag"},ma=function(a){return a},na=":",oa={type:"literal",value:":",description:'":"'},pa=function(a){return a},qa=function(a){return a?["context",a]:["context"]},ra={type:"other",description:"params"},sa="=",ta={type:"literal",value:"=",description:'"="'},ua=function(a,b){return["param",["literal",a],b]},va=function(a){return["params"].concat(a)},wa={type:"other",description:"bodies"},xa=function(a){return["bodies"].concat(a)},ya={type:"other",description:"reference"},za=function(a,b){return U(["reference",a,b])},Aa={type:"other",description:"partial"},Ba=">",Ca={type:"literal",value:">",description:'">"'},Da="+",Ea={type:"literal",value:"+",description:'"+"'},Fa=function(a){return["literal",a]},Ga=function(a,b,c,d){var e=">"===a?"partial":a;return U([e,b,c,d])},Ha={type:"other",description:"filters"},Ia="|",Ja={type:"literal",value:"|",description:'"|"'},Ka=function(a){return["filters"].concat(a)},La={type:"other",description:"special"},Ma="~",Na={type:"literal",value:"~",description:'"~"'},Oa=function(a){return U(["special",a])},Pa={type:"other",description:"identifier"},Qa=function(a){var b=["path"].concat(a);return b.text=a[1].join(".").replace(/,line,\d+,col,\d+/g,""),b},Ra=function(a){var b=["key",a];return b.text=a,b},Sa={type:"other",description:"number"},Ta=function(a){return["literal",a]},Ua={type:"other",description:"float"},Va=".",Wa={type:"literal",value:".",description:'"."'},Xa=function(a,b){return parseFloat(a+"."+b)},Ya={type:"other",description:"unsigned_integer"},Za=/^[0-9]/,$a={type:"class",value:"[0-9]",description:"[0-9]"},_a=function(a){return T(a)},ab={type:"other",description:"signed_integer"},bb="-",cb={type:"literal",value:"-",description:'"-"'},db=function(a,b){return-1*b},eb={type:"other",description:"integer"},fb={type:"other",description:"path"},gb=function(a,b){return b=b[0],a&&b?(b.unshift(a),U([!1,b])):U([!0,b])},hb=function(a){return U(a.length>0?[!0,a[0]]:[!0,[]])},ib={type:"other",description:"key"},jb=/^[a-zA-Z_$]/,kb={type:"class",value:"[a-zA-Z_$]",description:"[a-zA-Z_$]"},lb=/^[0-9a-zA-Z_$\-]/,mb={type:"class",value:"[0-9a-zA-Z_$\\-]",description:"[0-9a-zA-Z_$\\-]"},nb=function(a,b){return a+b.join("")},ob={type:"other",description:"array"},pb=function(a){return a.join("")},qb=function(a){return a},rb=function(a,b){return b?b.unshift(a):b=[a],b},sb={type:"other",description:"array_part"},tb=function(a){return a},ub=function(a,b){return b?a.concat(b):a},vb={type:"other",description:"inline"},wb='"',xb={type:"literal",value:'"',description:'"\\""'},yb=function(){return U(["literal",""])},zb=function(a){return U(["literal",a])},Ab=function(a){return U(["body"].concat(a))},Bb=function(a){return["buffer",a]},Cb={type:"other",description:"buffer"},Db=function(a,b){return U(["format",a,b.join("")])},Eb={type:"any",description:"any character"},Fb=function(a){return a},Gb=function(a){return U(["buffer",a.join("")])},Hb={type:"other",description:"literal"},Ib=/^[^"]/,Jb={type:"class",value:'[^"]',description:'[^"]'},Kb=function(a){return a.join("")},Lb='\\"',Mb={type:"literal",value:'\\"',description:'"\\\\\\""'},Nb=function(){return'"'},Ob={type:"other",description:"raw"},Pb="{`",Qb={type:"literal",value:"{`",description:'"{`"'},Rb="`}",Sb={type:"literal",value:"`}",description:'"`}"'},Tb=function(a){return a},Ub=function(a){return U(["raw",a.join("")])},Vb={type:"other",description:"comment"},Wb="{!",Xb={type:"literal",value:"{!",description:'"{!"'},Yb="!}",Zb={type:"literal",value:"!}",description:'"!}"'},$b=function(a){return U(["comment",a.join("")])},_b=/^[#?\^><+%:@\/~%]/,ac={type:"class",value:"[#?\\^><+%:@\\/~%]",description:"[#?\\^><+%:@\\/~%]"},bc="{",cc={type:"literal",value:"{",description:'"{"'},dc="}",ec={type:"literal",value:"}",description:'"}"'},fc="[",gc={type:"literal",value:"[",description:'"["'},hc="]",ic={type:"literal",value:"]",description:'"]"' +!function(a,b){"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.core",[],b):"object"==typeof exports?module.exports=b():a.dust=b()}(this,function(){function getTemplate(a,b){return a?"function"==typeof a&&a.template?a.template:dust.isTemplateFn(a)?a:b!==!1?dust.cache[a]:void 0:void 0}function load(a,b,c){if(!a)return b.setError(new Error("No template or template name provided to render"));var d=getTemplate(a,dust.config.cache);return d?d(b,Context.wrap(c,d.templateName)):dust.onLoad?b.map(function(b){function d(a,d){var f;if(a)return b.setError(a);if(f=getTemplate(d,!1)||getTemplate(e,dust.config.cache),!f){if(!dust.compile)return b.setError(new Error("Dust compiler not available"));f=dust.loadSource(dust.compile(d,e))}f(b,Context.wrap(c,f.templateName)).end()}var e=a;3===dust.onLoad.length?dust.onLoad(e,c.options,d):dust.onLoad(e,d)}):b.setError(new Error("Template Not Found: "+a))}function Context(a,b,c,d,e){void 0===a||a instanceof Stack||(a=new Stack(a)),this.stack=a,this.global=b,this.options=c,this.blocks=d,this.templateName=e,this._isContext=!0}function getWithResolvedData(a,b,c){return function(d){return a.push(d)._get(b,c)}}function Stack(a,b,c,d){this.tail=b,this.isObject=a&&"object"==typeof a,this.head=a,this.index=c,this.of=d}function Stub(a){this.head=new Chunk(this),this.callback=a,this.out=""}function Stream(){this.head=new Chunk(this)}function Chunk(a,b,c){this.root=a,this.next=b,this.data=[],this.flushable=!1,this.taps=c}function Tap(a,b){this.head=a,this.tail=b}var dust={version:"2.7.5"},NONE="NONE",ERROR="ERROR",WARN="WARN",INFO="INFO",DEBUG="DEBUG",EMPTY_FUNC=function(){};dust.config={whitespace:!1,amd:!1,cjs:!1,cache:!0},dust._aliases={write:"w",end:"e",map:"m",render:"r",reference:"f",section:"s",exists:"x",notexists:"nx",block:"b",partial:"p",helper:"h"},function(){var a,b,c={DEBUG:0,INFO:1,WARN:2,ERROR:3,NONE:4};"undefined"!=typeof console&&console.log?(a=console.log,b="function"==typeof a?function(){a.apply(console,arguments)}:function(){a(Array.prototype.slice.apply(arguments).join(" "))}):b=EMPTY_FUNC,dust.log=function(a,d){d=d||INFO,c[d]>=c[dust.debugLevel]&&b("[DUST:"+d+"]",a)},dust.debugLevel=NONE,"undefined"!=typeof process&&process.env&&/\bdust\b/.test(process.env.DEBUG)&&(dust.debugLevel=DEBUG)}(),dust.helpers={},dust.cache={},dust.register=function(a,b){a&&(b.templateName=a,dust.config.cache!==!1&&(dust.cache[a]=b))},dust.render=function(a,b,c){var d=new Stub(c).head;try{load(a,d,b).end()}catch(e){d.setError(e)}},dust.stream=function(a,b){var c=new Stream,d=c.head;return dust.nextTick(function(){try{load(a,d,b).end()}catch(c){d.setError(c)}}),c},dust.loadSource=function(source){return eval(source)},dust.isArray=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},dust.nextTick=function(){return function(a){setTimeout(a,0)}}(),dust.isEmpty=function(a){return 0===a?!1:dust.isArray(a)&&!a.length?!0:!a},dust.isEmptyObject=function(a){var b;if(null===a)return!1;if(void 0===a)return!1;if(a.length>0)return!1;for(b in a)if(Object.prototype.hasOwnProperty.call(a,b))return!1;return!0},dust.isTemplateFn=function(a){return"function"==typeof a&&a.__dustBody},dust.isThenable=function(a){return a&&"object"==typeof a&&"function"==typeof a.then},dust.isStreamable=function(a){return a&&"function"==typeof a.on&&"function"==typeof a.pipe},dust.filter=function(a,b,c,d){var e,f,g,h;if(c)for(e=0,f=c.length;f>e;e++)g=c[e],g.length&&(h=dust.filters[g],"s"===g?b=null:"function"==typeof h?a=h(a,d):dust.log("Invalid filter `"+g+"`",WARN));return b&&(a=dust.filters[b](a,d)),a},dust.filters={h:function(a){return dust.escapeHtml(a)},j:function(a){return dust.escapeJs(a)},u:encodeURI,uc:encodeURIComponent,js:function(a){return dust.escapeJSON(a)},jp:function(a){return JSON?JSON.parse(a):(dust.log("JSON is undefined; could not parse `"+a+"`",WARN),a)}},dust.makeBase=dust.context=function(a,b){return new Context(void 0,a,b)},dust.isContext=function(a){return"object"==typeof a&&a._isContext===!0},Context.wrap=function(a,b){return dust.isContext(a)?a:new Context(a,{},{},null,b)},Context.prototype.get=function(a,b){return"string"==typeof a&&("."===a[0]&&(b=!0,a=a.substr(1)),a=a.split(".")),this._get(b,a)},Context.prototype._get=function(a,b){var c,d,e,f,g,h=this.stack||{},i=1;if(d=b[0],e=b.length,a&&0===e)f=h,h=h.head;else{if(a)h&&(h=h.head?h.head[d]:void 0);else{for(;h&&(!h.isObject||(f=h.head,c=h.head[d],void 0===c));)h=h.tail;h=void 0!==c?c:this.global&&this.global[d]}for(;h&&e>i;){if(dust.isThenable(h))return h.then(getWithResolvedData(this,a,b.slice(i)));f=h,h=h[b[i]],i++}}return"function"==typeof h?(g=function(){try{return h.apply(f,arguments)}catch(a){throw dust.log(a,ERROR),a}},g.__dustBody=!!h.__dustBody,g):(void 0===h&&dust.log("Cannot find reference `{"+b.join(".")+"}` in template `"+this.getTemplateName()+"`",INFO),h)},Context.prototype.getPath=function(a,b){return this._get(a,b)},Context.prototype.push=function(a,b,c){return void 0===a?(dust.log("Not pushing an undefined variable onto the context",INFO),this):this.rebase(new Stack(a,this.stack,b,c))},Context.prototype.pop=function(){var a=this.current();return this.stack=this.stack&&this.stack.tail,a},Context.prototype.rebase=function(a){return new Context(a,this.global,this.options,this.blocks,this.getTemplateName())},Context.prototype.clone=function(){var a=this.rebase();return a.stack=this.stack,a},Context.prototype.current=function(){return this.stack&&this.stack.head},Context.prototype.getBlock=function(a){var b,c,d;if("function"==typeof a&&(a=a(new Chunk,this).data.join("")),b=this.blocks,!b)return dust.log("No blocks for context `"+a+"` in template `"+this.getTemplateName()+"`",DEBUG),!1;for(c=b.length;c--;)if(d=b[c][a])return d;return dust.log("Malformed template `"+this.getTemplateName()+"` was missing one or more blocks."),!1},Context.prototype.shiftBlocks=function(a){var b,c=this.blocks;return a?(b=c?c.concat([a]):[a],new Context(this.stack,this.global,this.options,b,this.getTemplateName())):this},Context.prototype.resolve=function(a){var b;return"function"!=typeof a?a:(b=(new Chunk).render(a,this),b instanceof Chunk?b.data.join(""):b)},Context.prototype.getTemplateName=function(){return this.templateName},Stub.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.callback(a.error),dust.log("Rendering failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.out+=a.data.join(""),a=a.next,this.head=a}this.callback(null,this.out)},Stream.prototype.flush=function(){for(var a=this.head;a;){if(!a.flushable)return a.error?(this.emit("error",a.error),this.emit("end"),dust.log("Streaming failed with error `"+a.error+"`",ERROR),void(this.flush=EMPTY_FUNC)):void 0;this.emit("data",a.data.join("")),a=a.next,this.head=a}this.emit("end")},Stream.prototype.emit=function(a,b){var c,d,e=this.events||{},f=e[a]||[];if(!f.length)return dust.log("Stream broadcasting, but no listeners for `"+a+"`",DEBUG),!1;for(f=f.slice(0),c=0,d=f.length;d>c;c++)f[c](b);return!0},Stream.prototype.on=function(a,b){var c=this.events=this.events||{},d=c[a]=c[a]||[];return"function"!=typeof b?dust.log("No callback function provided for `"+a+"` event listener",WARN):d.push(b),this},Stream.prototype.pipe=function(a){if("function"!=typeof a.write||"function"!=typeof a.end)return dust.log("Incompatible stream passed to `pipe`",WARN),this;var b=!1;return"function"==typeof a.emit&&a.emit("pipe",this),"function"==typeof a.on&&a.on("error",function(){b=!0}),this.on("data",function(c){if(!b)try{a.write(c,"utf8")}catch(d){dust.log(d,ERROR)}}).on("end",function(){if(!b)try{a.end(),b=!0}catch(c){dust.log(c,ERROR)}})},Chunk.prototype.write=function(a){var b=this.taps;return b&&(a=b.go(a)),this.data.push(a),this},Chunk.prototype.end=function(a){return a&&this.write(a),this.flushable=!0,this.root.flush(),this},Chunk.prototype.map=function(a){var b=new Chunk(this.root,this.next,this.taps),c=new Chunk(this.root,b,this.taps);this.next=c,this.flushable=!0;try{a(c)}catch(d){dust.log(d,ERROR),c.setError(d)}return b},Chunk.prototype.tap=function(a){var b=this.taps;return this.taps=b?b.push(a):new Tap(a),this},Chunk.prototype.untap=function(){return this.taps=this.taps.tail,this},Chunk.prototype.render=function(a,b){return a(this,b)},Chunk.prototype.reference=function(a,b,c,d){return"function"==typeof a?(a=a.apply(b.current(),[this,b,null,{auto:c,filters:d}]),a instanceof Chunk?a:this.reference(a,b,c,d)):dust.isThenable(a)?this.await(a,b,null,c,d):dust.isStreamable(a)?this.stream(a,b,null,c,d):dust.isEmpty(a)?this:this.write(dust.filter(a,c,d,b))},Chunk.prototype.section=function(a,b,c,d){var e,f,g,h=c.block,i=c["else"],j=this;if("function"==typeof a&&!dust.isTemplateFn(a)){try{a=a.apply(b.current(),[this,b,c,d])}catch(k){return dust.log(k,ERROR),this.setError(k)}if(a instanceof Chunk)return a}if(dust.isEmptyObject(c))return j;if(dust.isEmptyObject(d)||(b=b.push(d)),dust.isArray(a)){if(h){if(f=a.length,f>0){for(g=b.stack&&b.stack.head||{},g.$len=f,e=0;f>e;e++)g.$idx=e,j=h(j,b.push(a[e],e,f));return g.$idx=void 0,g.$len=void 0,j}if(i)return i(this,b)}}else{if(dust.isThenable(a))return this.await(a,b,c);if(dust.isStreamable(a))return this.stream(a,b,c);if(a===!0){if(h)return h(this,b)}else if(a||0===a){if(h)return h(this,b.push(a))}else if(i)return i(this,b)}return dust.log("Section without corresponding key in template `"+b.getTemplateName()+"`",DEBUG),this},Chunk.prototype.exists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(e)return e(this,b)}else{if(d)return d(this,b);dust.log("No block for exists check in template `"+b.getTemplateName()+"`",DEBUG)}return this},Chunk.prototype.notexists=function(a,b,c){var d=c.block,e=c["else"];if(dust.isEmpty(a)){if(d)return d(this,b);dust.log("No block for not-exists check in template `"+b.getTemplateName()+"`",DEBUG)}else if(e)return e(this,b);return this},Chunk.prototype.block=function(a,b,c){var d=a||c.block;return d?d(this,b):this},Chunk.prototype.partial=function(a,b,c,d){var e;return void 0===d&&(d=c,c=b),dust.isEmptyObject(d)||(c=c.clone(),e=c.pop(),c=c.push(d).push(e)),dust.isTemplateFn(a)?this.capture(a,b,function(a,b){c.templateName=a,load(a,b,c).end()}):(c.templateName=a,load(a,this,c))},Chunk.prototype.helper=function(a,b,c,d,e){var f,g=this,h=d.filters;if(void 0===e&&(e="h"),!dust.helpers[a])return dust.log("Helper `"+a+"` does not exist",WARN),g;try{return f=dust.helpers[a](g,b,c,d),f instanceof Chunk?f:("string"==typeof h&&(h=h.split("|")),dust.isEmptyObject(c)?g.reference(f,b,e,h):g.section(f,b,c,d))}catch(i){return dust.log("Error in helper `"+a+"`: "+i.message,ERROR),g.setError(i)}},Chunk.prototype.await=function(a,b,c,d,e){return this.map(function(f){a.then(function(a){f=c?f.section(a,b,c):f.reference(a,b,d,e),f.end()},function(a){var d=c&&c.error;d?f.render(d,b.push(a)).end():(dust.log("Unhandled promise rejection in `"+b.getTemplateName()+"`",INFO),f.end())})})},Chunk.prototype.stream=function(a,b,c,d,e){var f=c&&c.block,g=c&&c.error;return this.map(function(h){var i=!1;a.on("data",function(a){i||(f?h=h.map(function(c){c.render(f,b.push(a)).end()}):c||(h=h.reference(a,b,d,e)))}).on("error",function(a){i||(g?h.render(g,b.push(a)):dust.log("Unhandled stream error in `"+b.getTemplateName()+"`",INFO),i||(i=!0,h.end()))}).on("end",function(){i||(i=!0,h.end())})})},Chunk.prototype.capture=function(a,b,c){return this.map(function(d){var e=new Stub(function(a,b){a?d.setError(a):c(b,d)});a(e.head,b).end()})},Chunk.prototype.setError=function(a){return this.error=a,this.root.flush(),this};for(var f in Chunk.prototype)dust._aliases[f]&&(Chunk.prototype[dust._aliases[f]]=Chunk.prototype[f]);Tap.prototype.push=function(a){return new Tap(a,this)},Tap.prototype.go=function(a){for(var b=this;b;)a=b.head(a),b=b.tail;return a};var HCHARS=/[&<>"']/,AMP=/&/g,LT=//g,QUOT=/\"/g,SQUOT=/\'/g;dust.escapeHtml=function(a){return"string"==typeof a||a&&"function"==typeof a.toString?("string"!=typeof a&&(a=a.toString()),HCHARS.test(a)?a.replace(AMP,"&").replace(LT,"<").replace(GT,">").replace(QUOT,""").replace(SQUOT,"'"):a):a};var BS=/\\/g,FS=/\//g,CR=/\r/g,LS=/\u2028/g,PS=/\u2029/g,NL=/\n/g,LF=/\f/g,SQ=/'/g,DQ=/"/g,TB=/\t/g;return dust.escapeJs=function(a){return"string"==typeof a?a.replace(BS,"\\\\").replace(FS,"\\/").replace(DQ,'\\"').replace(SQ,"\\'").replace(CR,"\\r").replace(LS,"\\u2028").replace(PS,"\\u2029").replace(NL,"\\n").replace(LF,"\\f").replace(TB,"\\t"):a},dust.escapeJSON=function(a){return JSON?JSON.stringify(a).replace(LS,"\\u2028").replace(PS,"\\u2029").replace(LT,"\\u003c"):(dust.log("JSON is undefined; could not escape `"+a+"`",WARN),a)},dust}),function(a,b){"function"==typeof define&&define.amd&&define.amd.dust===!0?define("dust.parse",["dust.core"],function(dust){return b(dust).parse}):"object"==typeof exports?module.exports=b(require("./dust")):b(a.dust)}(this,function(dust){var a=function(){function a(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}function b(a,b,c,d,e,f){this.message=a,this.expected=b,this.found=c,this.offset=d,this.line=e,this.column=f,this.name="SyntaxError"}function c(a){function c(){return f(wc).line}function d(){return f(wc).column}function e(a){throw h(a,null,wc)}function f(b){function c(b,c,d){var e,f;for(e=c;d>e;e++)f=a.charAt(e),"\n"===f?(b.seenCR||b.line++,b.column=1,b.seenCR=!1):"\r"===f||"\u2028"===f||"\u2029"===f?(b.line++,b.column=1,b.seenCR=!0):(b.column++,b.seenCR=!1)}return xc!==b&&(xc>b&&(xc=0,yc={line:1,column:1,seenCR:!1}),c(yc,xc,b),xc=b),yc}function g(a){zc>vc||(vc>zc&&(zc=vc,Ac=[]),Ac.push(a))}function h(c,d,e){function g(a){var b=1;for(a.sort(function(a,b){return a.descriptionb.description?1:0});b1?g.slice(0,-1).join(", ")+" or "+g[a.length-1]:g[0],e=b?'"'+c(b)+'"':"end of input","Expected "+d+" but "+e+" found."}var i=f(e),j=evc?(j=a.charAt(vc),vc++):(j=X,0===Bc&&g(Eb)),j!==X?(wc=d,e=Fb(j),d=e):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa),d!==X)for(;d!==X;)c.push(d),d=vc,e=vc,Bc++,f=M(),Bc--,f===X?e=da:(vc=e,e=aa),e!==X?(f=vc,Bc++,h=K(),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(h=vc,Bc++,i=L(),Bc--,i===X?h=da:(vc=h,h=aa),h!==X?(i=vc,Bc++,j=R(),Bc--,j===X?i=da:(vc=i,i=aa),i!==X?(a.length>vc?(j=a.charAt(vc),vc++):(j=X,0===Bc&&g(Eb)),j!==X?(wc=d,e=Fb(j),d=e):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa)):(vc=d,d=aa);else c=aa;c!==X&&(wc=b,c=Gb(c)),b=c}return Bc--,b===X&&(c=X,0===Bc&&g(Cb)),b}function I(){var b,c,d,e,f;if(Bc++,b=vc,c=[],d=vc,e=vc,Bc++,f=M(),Bc--,f===X?e=da:(vc=e,e=aa),e!==X?(f=J(),f===X&&(Ib.test(a.charAt(vc))?(f=a.charAt(vc),vc++):(f=X,0===Bc&&g(Jb))),f!==X?(wc=d,e=Fb(f),d=e):(vc=d,d=aa)):(vc=d,d=aa),d!==X)for(;d!==X;)c.push(d),d=vc,e=vc,Bc++,f=M(),Bc--,f===X?e=da:(vc=e,e=aa),e!==X?(f=J(),f===X&&(Ib.test(a.charAt(vc))?(f=a.charAt(vc),vc++):(f=X,0===Bc&&g(Jb))),f!==X?(wc=d,e=Fb(f),d=e):(vc=d,d=aa)):(vc=d,d=aa);else c=aa;return c!==X&&(wc=b,c=Kb(c)),b=c,Bc--,b===X&&(c=X,0===Bc&&g(Hb)),b}function J(){var b,c;return b=vc,a.substr(vc,2)===Lb?(c=Lb,vc+=2):(c=X,0===Bc&&g(Mb)),c!==X&&(wc=b,c=Nb()),b=c}function K(){var b,c,d,e,f,h;if(Bc++,b=vc,a.substr(vc,2)===Pb?(c=Pb,vc+=2):(c=X,0===Bc&&g(Qb)),c!==X){for(d=[],e=vc,f=vc,Bc++,a.substr(vc,2)===Rb?(h=Rb,vc+=2):(h=X,0===Bc&&g(Sb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Tb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);e!==X;)d.push(e),e=vc,f=vc,Bc++,a.substr(vc,2)===Rb?(h=Rb,vc+=2):(h=X,0===Bc&&g(Sb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Tb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);d!==X?(a.substr(vc,2)===Rb?(e=Rb,vc+=2):(e=X,0===Bc&&g(Sb)),e!==X?(wc=b,c=Ub(d),b=c):(vc=b,b=aa)):(vc=b,b=aa)}else vc=b,b=aa;return Bc--,b===X&&(c=X,0===Bc&&g(Ob)),b}function L(){var b,c,d,e,f,h;if(Bc++,b=vc,a.substr(vc,2)===Wb?(c=Wb,vc+=2):(c=X,0===Bc&&g(Xb)),c!==X){for(d=[],e=vc,f=vc,Bc++,a.substr(vc,2)===Yb?(h=Yb,vc+=2):(h=X,0===Bc&&g(Zb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Fb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);e!==X;)d.push(e),e=vc,f=vc,Bc++,a.substr(vc,2)===Yb?(h=Yb,vc+=2):(h=X,0===Bc&&g(Zb)),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(a.length>vc?(h=a.charAt(vc),vc++):(h=X,0===Bc&&g(Eb)),h!==X?(wc=e,f=Fb(h),e=f):(vc=e,e=aa)):(vc=e,e=aa);d!==X?(a.substr(vc,2)===Yb?(e=Yb,vc+=2):(e=X,0===Bc&&g(Zb)),e!==X?(wc=b,c=$b(d),b=c):(vc=b,b=aa)):(vc=b,b=aa)}else vc=b,b=aa;return Bc--,b===X&&(c=X,0===Bc&&g(Vb)),b}function M(){var b,c,d,e,f,h,i,j,k,l;if(b=vc,c=N(),c!==X){for(d=[],e=S();e!==X;)d.push(e),e=S();if(d!==X)if(_b.test(a.charAt(vc))?(e=a.charAt(vc),vc++):(e=X,0===Bc&&g(ac)),e!==X){for(f=[],h=S();h!==X;)f.push(h),h=S();if(f!==X){if(h=[],i=vc,j=vc,Bc++,k=O(),Bc--,k===X?j=da:(vc=j,j=aa),j!==X?(k=vc,Bc++,l=R(),Bc--,l===X?k=da:(vc=k,k=aa),k!==X?(a.length>vc?(l=a.charAt(vc),vc++):(l=X,0===Bc&&g(Eb)),l!==X?(j=[j,k,l],i=j):(vc=i,i=aa)):(vc=i,i=aa)):(vc=i,i=aa),i!==X)for(;i!==X;)h.push(i),i=vc,j=vc,Bc++,k=O(),Bc--,k===X?j=da:(vc=j,j=aa),j!==X?(k=vc,Bc++,l=R(),Bc--,l===X?k=da:(vc=k,k=aa),k!==X?(a.length>vc?(l=a.charAt(vc),vc++):(l=X,0===Bc&&g(Eb)),l!==X?(j=[j,k,l],i=j):(vc=i,i=aa)):(vc=i,i=aa)):(vc=i,i=aa);else h=aa;if(h!==X){for(i=[],j=S();j!==X;)i.push(j),j=S();i!==X?(j=O(),j!==X?(c=[c,d,e,f,h,i,j],b=c):(vc=b,b=aa)):(vc=b,b=aa)}else vc=b,b=aa}else vc=b,b=aa}else vc=b,b=aa;else vc=b,b=aa}else vc=b,b=aa;return b===X&&(b=r()),b}function N(){var b;return 123===a.charCodeAt(vc)?(b=bc,vc++):(b=X,0===Bc&&g(cc)),b}function O(){var b;return 125===a.charCodeAt(vc)?(b=dc,vc++):(b=X,0===Bc&&g(ec)),b}function P(){var b;return 91===a.charCodeAt(vc)?(b=fc,vc++):(b=X,0===Bc&&g(gc)),b}function Q(){var b;return 93===a.charCodeAt(vc)?(b=hc,vc++):(b=X,0===Bc&&g(ic)),b}function R(){var b;return 10===a.charCodeAt(vc)?(b=jc,vc++):(b=X,0===Bc&&g(kc)),b===X&&(a.substr(vc,2)===lc?(b=lc,vc+=2):(b=X,0===Bc&&g(mc)),b===X&&(13===a.charCodeAt(vc)?(b=nc,vc++):(b=X,0===Bc&&g(oc)),b===X&&(8232===a.charCodeAt(vc)?(b=pc,vc++):(b=X,0===Bc&&g(qc)),b===X&&(8233===a.charCodeAt(vc)?(b=rc,vc++):(b=X,0===Bc&&g(sc)))))),b}function S(){var b;return tc.test(a.charAt(vc))?(b=a.charAt(vc),vc++):(b=X,0===Bc&&g(uc)),b===X&&(b=R()),b}function T(a){return parseInt(a.join(""),10)}function U(a){return a.concat([["line",c()],["col",d()]])}var V,W=arguments.length>1?arguments[1]:{},X={},Y={start:i},Z=i,$=function(a){var b=["body"].concat(a);return U(b)},_={type:"other",description:"section"},aa=X,ba=null,ca=function(a,b,c,d){return d&&a[1].text===d.text||e("Expected end tag for "+a[1].text+" but it was not found."),!0},da=void 0,ea=function(a,b,c){return c.push(["param",["literal","block"],b]),a.push(c,["filters"]),U(a)},fa="/",ga={type:"literal",value:"/",description:'"/"'},ha=function(a){return a.push(["bodies"],["filters"]),U(a)},ia=/^[#?\^<+@%]/,ja={type:"class",value:"[#?\\^<+@%]",description:"[#?\\^<+@%]"},ka=function(a,b,c,d){return[a,b,c,d]},la={type:"other",description:"end tag"},ma=function(a){return a},na=":",oa={type:"literal",value:":",description:'":"'},pa=function(a){return a},qa=function(a){return a?["context",a]:["context"]},ra={type:"other",description:"params"},sa="=",ta={type:"literal",value:"=",description:'"="'},ua=function(a,b){return["param",["literal",a],b]},va=function(a){return["params"].concat(a)},wa={type:"other",description:"bodies"},xa=function(a){return["bodies"].concat(a)},ya={type:"other",description:"reference"},za=function(a,b){return U(["reference",a,b])},Aa={type:"other",description:"partial"},Ba=">",Ca={type:"literal",value:">",description:'">"'},Da="+",Ea={type:"literal",value:"+",description:'"+"'},Fa=function(a){return["literal",a]},Ga=function(a,b,c,d){var e=">"===a?"partial":a;return U([e,b,c,d])},Ha={type:"other",description:"filters"},Ia="|",Ja={type:"literal",value:"|",description:'"|"'},Ka=function(a){return["filters"].concat(a)},La={type:"other",description:"special"},Ma="~",Na={type:"literal",value:"~",description:'"~"'},Oa=function(a){return U(["special",a])},Pa={type:"other",description:"identifier"},Qa=function(a){var b=["path"].concat(a);return b.text=a[1].join(".").replace(/,line,\d+,col,\d+/g,""),b},Ra=function(a){var b=["key",a];return b.text=a,b},Sa={type:"other",description:"number"},Ta=function(a){return["literal",a]},Ua={type:"other",description:"float"},Va=".",Wa={type:"literal",value:".",description:'"."'},Xa=function(a,b){return parseFloat(a+"."+b)},Ya={type:"other",description:"unsigned_integer"},Za=/^[0-9]/,$a={type:"class",value:"[0-9]",description:"[0-9]"},_a=function(a){return T(a)},ab={type:"other",description:"signed_integer"},bb="-",cb={type:"literal",value:"-",description:'"-"'},db=function(a,b){return-1*b},eb={type:"other",description:"integer"},fb={type:"other",description:"path"},gb=function(a,b){return b=b[0],a&&b?(b.unshift(a),U([!1,b])):U([!0,b])},hb=function(a){return U(a.length>0?[!0,a[0]]:[!0,[]])},ib={type:"other",description:"key"},jb=/^[a-zA-Z_$]/,kb={type:"class",value:"[a-zA-Z_$]",description:"[a-zA-Z_$]"},lb=/^[0-9a-zA-Z_$\-]/,mb={type:"class",value:"[0-9a-zA-Z_$\\-]",description:"[0-9a-zA-Z_$\\-]"},nb=function(a,b){return a+b.join("")},ob={type:"other",description:"array"},pb=function(a){return a.join("")},qb=function(a){return a},rb=function(a,b){return b?b.unshift(a):b=[a],b},sb={type:"other",description:"array_part"},tb=function(a){return a},ub=function(a,b){return b?a.concat(b):a},vb={type:"other",description:"inline"},wb='"',xb={type:"literal",value:'"',description:'"\\""'},yb=function(){return U(["literal",""])},zb=function(a){return U(["literal",a])},Ab=function(a){return U(["body"].concat(a))},Bb=function(a){return["buffer",a]},Cb={type:"other",description:"buffer"},Db=function(a,b){return U(["format",a,b.join("")])},Eb={type:"any",description:"any character"},Fb=function(a){return a},Gb=function(a){return U(["buffer",a.join("")])},Hb={type:"other",description:"literal"},Ib=/^[^"]/,Jb={type:"class",value:'[^"]',description:'[^"]'},Kb=function(a){return a.join("")},Lb='\\"',Mb={type:"literal",value:'\\"',description:'"\\\\\\""'},Nb=function(){return'"'},Ob={type:"other",description:"raw"},Pb="{`",Qb={type:"literal",value:"{`",description:'"{`"'},Rb="`}",Sb={type:"literal",value:"`}",description:'"`}"'},Tb=function(a){return a},Ub=function(a){return U(["raw",a.join("")])},Vb={type:"other",description:"comment"},Wb="{!",Xb={type:"literal",value:"{!",description:'"{!"'},Yb="!}",Zb={type:"literal",value:"!}",description:'"!}"'},$b=function(a){return U(["comment",a.join("")])},_b=/^[#?\^><+%:@\/~%]/,ac={type:"class",value:"[#?\\^><+%:@\\/~%]",description:"[#?\\^><+%:@\\/~%]"},bc="{",cc={type:"literal",value:"{",description:'"{"'},dc="}",ec={type:"literal",value:"}",description:'"}"'},fc="[",gc={type:"literal",value:"[",description:'"["'},hc="]",ic={type:"literal",value:"]",description:'"]"' },jc="\n",kc={type:"literal",value:"\n",description:'"\\n"'},lc="\r\n",mc={type:"literal",value:"\r\n",description:'"\\r\\n"'},nc="\r",oc={type:"literal",value:"\r",description:'"\\r"'},pc="\u2028",qc={type:"literal",value:"\u2028",description:'"\\u2028"'},rc="\u2029",sc={type:"literal",value:"\u2029",description:'"\\u2029"'},tc=/^[\t\x0B\f \xA0\uFEFF]/,uc={type:"class",value:"[\\t\\x0B\\f \\xA0\\uFEFF]",description:"[\\t\\x0B\\f \\xA0\\uFEFF]"},vc=0,wc=0,xc=0,yc={line:1,column:1,seenCR:!1},zc=0,Ac=[],Bc=0;if("startRule"in W){if(!(W.startRule in Y))throw new Error("Can't start parsing from rule \""+W.startRule+'".');Z=Y[W.startRule]}if(V=Z(),V!==X&&vc===a.length)return V;throw V!==X&&vcc;c++)e=r.filterNode(a,b[c]),e&&f.push(e);return f}function d(a,b){var c,d,e,f,g=[b[0]];for(d=1,e=b.length;e>d;d++)f=r.filterNode(a,b[d]),f&&("buffer"===f[0]||"format"===f[0]?c?(c[0]="buffer"===f[0]?"buffer":c[0],c[1]+=f.slice(1,-2).join("")):(c=f,g.push(f)):(c=null,g.push(f)));return g}function e(a,b){return["buffer",t[b[1]],b[2],b[3]]}function f(a,b){return b}function g(){}function h(a,b){return dust.config.whitespace?(b.splice(1,2,b.slice(1,-2).join("")),b):null}function i(a,b){var c,d={name:b,bodies:[],blocks:{},index:0,auto:"h"},e=dust.escapeJs(b),f=b?'"'+e+'",':"",g="function(dust){",h=r.compileNode(d,a);return b&&(g+='dust.register("'+e+'",'+h+");"),g+=j(d)+k(d)+"return "+h+"}",c="("+g+"(dust));",dust.config.amd?"define("+f+'["dust.core"],'+g+");":dust.config.cjs?"module.exports=function(dust){var tmpl="+c+"var f="+q().toString()+";f.template=tmpl;return f}":c}function j(a){var b,c=[],d=a.blocks;for(b in d)c.push('"'+b+'":'+d[b]);return c.length?(a.blocks="ctx=ctx.shiftBlocks(blocks);","var blocks={"+c.join(",")+"};"):(a.blocks="",a.blocks)}function k(a){var b,c,d=[],e=a.bodies,f=a.blocks;for(b=0,c=e.length;c>b;b++)d[b]="function body_"+b+"(chk,ctx){"+f+"return chk"+e[b]+";}body_"+b+".__dustBody=!0;";return d.join("")}function l(a,b){var c,d,e="";for(c=1,d=b.length;d>c;c++)e+=r.compileNode(a,b[c]);return e}function m(a,b,c){return"."+(dust._aliases[c]||c)+"("+r.compileNode(a,b[1])+","+r.compileNode(a,b[2])+","+r.compileNode(a,b[4])+","+r.compileNode(a,b[3])+")"}function n(a){return a.replace(u,"\\\\").replace(v,'\\"').replace(w,"\\f").replace(x,"\\n").replace(y,"\\r").replace(z,"\\t")}function o(a,b,c){var d=dust.loadSource(dust.compile(a));return q(d)(b,c)}function p(a,b){var c=dust.loadSource(dust.compile(a,b));return q(c)}function q(a){return function(b,c){var d=c?"render":"stream";return dust[d](a,b,c)}}var r={},s=dust.isArray;r.compile=function(c,d){try{var e=b(a(c));return i(e,d)}catch(f){if(!f.line||!f.column)throw f;throw new SyntaxError(f.message+" At line : "+f.line+", column : "+f.column)}},r.filterNode=function(a,b){return r.optimizers[b[0]](a,b)},r.optimizers={body:d,buffer:f,special:e,format:h,reference:c,"#":c,"?":c,"^":c,"<":c,"+":c,"@":c,"%":c,partial:c,context:c,params:c,bodies:c,param:c,filters:f,key:f,path:f,literal:f,raw:f,comment:g,line:g,col:g},r.pragmas={esc:function(a,b,c){var d,e=a.auto;return b||(b="h"),a.auto="s"===b?"":b,d=l(a,c.block),a.auto=e,d}};var t={s:" ",n:"\n",r:"\r",lb:"{",rb:"}"};r.compileNode=function(a,b){return r.nodes[b[0]](a,b)},r.nodes={body:function(a,b){var c=a.index++,d="body_"+c;return a.bodies[c]=l(a,b),d},buffer:function(a,b){return".w("+A(b[1])+")"},format:function(a,b){return".w("+A(b[1])+")"},reference:function(a,b){return".f("+r.compileNode(a,b[1])+",ctx,"+r.compileNode(a,b[2])+")"},"#":function(a,b){return m(a,b,"section")},"?":function(a,b){return m(a,b,"exists")},"^":function(a,b){return m(a,b,"notexists")},"<":function(a,b){for(var c=b[4],d=1,e=c.length;e>d;d++){var f=c[d],g=f[1][1];if("block"===g)return a.blocks[b[1].text]=r.compileNode(a,f[2]),""}return""},"+":function(a,b){return"undefined"==typeof b[1].text&&"undefined"==typeof b[4]?".b(ctx.getBlock("+r.compileNode(a,b[1])+",chk, ctx),"+r.compileNode(a,b[2])+", {},"+r.compileNode(a,b[3])+")":".b(ctx.getBlock("+A(b[1].text)+"),"+r.compileNode(a,b[2])+","+r.compileNode(a,b[4])+","+r.compileNode(a,b[3])+")"},"@":function(a,b){return".h("+A(b[1].text)+","+r.compileNode(a,b[2])+","+r.compileNode(a,b[4])+","+r.compileNode(a,b[3])+","+r.compileNode(a,b[5])+")"},"%":function(a,b){var c,d,e,f,g,h,i,j,k,l=b[1][1];if(!r.pragmas[l])return"";for(c=b[4],d={},j=1,k=c.length;k>j;j++)h=c[j],d[h[1][1]]=h[2];for(e=b[3],f={},j=1,k=e.length;k>j;j++)i=e[j],f[i[1][1]]=i[2][1];return g=b[2][1]?b[2][1].text:null,r.pragmas[l](a,g,d,f)},partial:function(a,b){return".p("+r.compileNode(a,b[1])+",ctx,"+r.compileNode(a,b[2])+","+r.compileNode(a,b[3])+")"},context:function(a,b){return b[1]?"ctx.rebase("+r.compileNode(a,b[1])+")":"ctx"},params:function(a,b){for(var c=[],d=1,e=b.length;e>d;d++)c.push(r.compileNode(a,b[d]));return c.length?"{"+c.join(",")+"}":"{}"},bodies:function(a,b){for(var c=[],d=1,e=b.length;e>d;d++)c.push(r.compileNode(a,b[d]));return"{"+c.join(",")+"}"},param:function(a,b){return r.compileNode(a,b[1])+":"+r.compileNode(a,b[2])},filters:function(a,b){for(var c=[],d=1,e=b.length;e>d;d++){var f=b[d];c.push('"'+f+'"')}return'"'+a.auto+'"'+(c.length?",["+c.join(",")+"]":"")},key:function(a,b){return'ctx.get(["'+b[1]+'"], false)'},path:function(a,b){for(var c=b[1],d=b[2],e=[],f=0,g=d.length;g>f;f++)e.push(s(d[f])?r.compileNode(a,d[f]):'"'+d[f]+'"');return"ctx.getPath("+c+", ["+e.join(",")+"])"},literal:function(a,b){return A(b[1])},raw:function(a,b){return".w("+A(b[1])+")"}};var u=/\\/g,v=/"/g,w=/\f/g,x=/\n/g,y=/\r/g,z=/\t/g,A="undefined"==typeof JSON?function(a){return'"'+n(a)+'"'}:JSON.stringify;return dust.compiler=r,dust.compile=dust.compiler.compile,dust.renderSource=o,dust.compileFn=p,dust.filterNode=r.filterNode,dust.optimizers=r.optimizers,dust.pragmas=r.pragmas,dust.compileNode=r.compileNode,dust.nodes=r.nodes,r}),"function"==typeof define&&define.amd&&define.amd.dust===!0&&define(["require","dust.core","dust.compile"],function(require,dust){return dust.onLoad=function(a,b){require([a],function(){b()})},dust}); \ No newline at end of file diff --git a/lib/dust.js b/lib/dust.js index d0196a60..946a86ee 100644 --- a/lib/dust.js +++ b/lib/dust.js @@ -8,7 +8,7 @@ } }(this, function() { var dust = { - "version": "2.7.4" + "version": "2.7.5" }, NONE = 'NONE', ERROR = 'ERROR', WARN = 'WARN', INFO = 'INFO', DEBUG = 'DEBUG', EMPTY_FUNC = function() {}; diff --git a/package.json b/package.json index 9132877f..a649da6a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dustjs-linkedin", - "version": "2.7.4", + "version": "2.7.5", "author": { "name": "Aleksander Williams", "url": "http://akdubya.github.com/dustjs"