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

liquidjs

Package Overview
Dependencies
Maintainers
1
Versions
208
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

liquidjs - npm Package Compare versions

Comparing version 3.1.1 to 3.1.2

2

dist/liquid.min.js

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

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Liquid=e()}}(function(){return function e(t,r,n){function s(o,u){if(!r[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[o]={exports:{}};t[o][0].call(l.exports,function(e){var r=t[o][1][e];return s(r||e)},l,l.exports,e,t,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o<n.length;o++)s(n[o]);return s}({1:[function(e,t,r){"use strict";var n=e("./src/util/strftime.js"),s=e("./src/util/underscore.js"),i=e("./src/syntax.js").isTruthy,o={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&#34;","'":"&#39;"},u={"&amp;":"&","&lt;":"<","&gt;":">","&#34;":'"',"&#39;":"'"},a={abs:function(e){return Math.abs(e)},append:function(e,t){return e+t},capitalize:function(e){return f(e).charAt(0).toUpperCase()+e.slice(1)},ceil:function(e){return Math.ceil(e)},concat:function(e,t){return Array.prototype.concat.call(e,t)},date:function(e,t){var r,i=e;return"now"===e?i=new Date:s.isString(e)&&(i=new Date(e)),(r=i)instanceof Date&&!isNaN(r.getTime())?n(i,t):e},default:function(e,t){return i(e)?e:t},divided_by:function(e,t){return Math.floor(e/t)},downcase:function(e){return e.toLowerCase()},escape:c,escape_once:function(e){return c(f(e).replace(/&(amp|lt|gt|#34|#39);/g,function(e){return u[e]}))},first:function(e){return e[0]},floor:function(e){return Math.floor(e)},join:function(e,t){return e.join(t)},last:function(e){return e[e.length-1]},lstrip:function(e){return f(e).replace(/^\s+/,"")},map:function(e,t){return e.map(function(e){return e[t]})},minus:p(function(e,t){return e-t}),modulo:p(function(e,t){return e%t}),newline_to_br:function(e){return e.replace(/\n/g,"<br />")},plus:p(function(e,t){return Number(e)+Number(t)}),prepend:function(e,t){return t+e},remove:function(e,t){return e.split(t).join("")},remove_first:function(e,t){return e.replace(t,"")},replace:function(e,t,r){return f(e).split(t).join(r)},replace_first:function(e,t,r){return f(e).replace(t,r)},reverse:function(e){return e.reverse()},round:function(e,t){var r=Math.pow(10,t||0);return Math.round(e*r,t)/r},rstrip:function(e){return f(e).replace(/\s+$/,"")},size:function(e){return e.length},slice:function(e,t,r){return e.substr(t,void 0===r?1:r)},sort:function(e,t){return e.sort(t)},split:function(e,t){return f(e).split(t)},strip:function(e){return f(e).trim()},strip_html:function(e){return f(e).replace(/<\/?\s*\w+\s*\/?>/g,"")},strip_newlines:function(e){return f(e).replace(/\n/g,"")},times:function(e,t){return e*t},truncate:function(e,t,r){return e=f(e),r=void 0===r?"...":r,t=t||16,e.length<=t?e:e.substr(0,t-r.length)+r},truncatewords:function(e,t,r){void 0===r&&(r="...");var n=e.split(" "),s=n.slice(0,t).join(" ");return n.length>t&&(s+=r),s},uniq:function(e){var t={};return(e||[]).filter(function(e){return!t.hasOwnProperty(e)&&(t[e]=!0,!0)})},upcase:function(e){return f(e).toUpperCase()},url_encode:encodeURIComponent};function c(e){return f(e).replace(/&|<|>|"|'/g,function(e){return o[e]})}function l(e){var t=(e+"").split(".");return t.length>1?t[1].length:0}function f(e){return e+""}function p(e){return function(t,r){var n,s,i=(n=t,s=r,Math.max(l(n),l(s)));return e(t,r).toFixed(i)}}function h(e){return s.forOwn(a,function(t,r){return e.registerFilter(r,t)})}h.filters=a,t.exports=h},{"./src/syntax.js":15,"./src/util/strftime.js":22,"./src/util/underscore.js":23}],2:[function(e,t,r){"use strict";var n=e("./src/scope"),s=e("./src/util/underscore.js"),i=e("./src/util/assert.js"),o=e("./src/tokenizer.js"),u=e("./src/util/fs.js").statFileAsync,a=e("./src/util/fs.js").readFileAsync,c=e("path"),l=e("./src/util/url.js"),f=e("./src/render.js"),p=e("./src/lexical.js"),h=e("./src/tag.js"),g=e("./src/filter.js"),d=e("./src/parser"),v=e("./src/syntax.js"),m=e("./tags"),y=e("./filters"),j=e("any-promise"),w=e("./src/util/promise.js").anySeries,x=e("./src/util/error.js"),b={init:function(e,t,r){return r.cache&&(this.cache={}),this.options=r,this.tag=e,this.filter=t,this.parser=d(e,t),this.renderer=f(),m(this),y(this),this},parse:function(e,t){var r=o.parse(e,t,this.options);return this.parser.parse(r)},render:function(e,t,r){r=s.assign({},this.options,r);var i=n.factory(t,r);return this.renderer.renderTemplates(e,i)},parseAndRender:function(e,t,r){var n=this;return j.resolve().then(function(){return n.parse(e)}).then(function(e){return n.render(e,t,r)})},renderFile:function(e,t,r){var n=this;return r=s.assign({},r),this.getTemplate(e,r.root).then(function(e){return n.render(e,t,r)})},evalValue:function(e,t){var r=this.parser.parseValue(e.trim());return this.renderer.evalValue(r,t)},registerFilter:function(e,t){return this.filter.register(e,t)},registerTag:function(e,t){return this.tag.register(e,t)},lookup:function(e,t){t=this.options.root.concat(t||[]);var r=(t=s.uniq(t)).map(function(t){return c.resolve(t,e)});return w(r,function(e){return u(e).then(function(){return e})}).catch(function(r){throw r.message=r.code+": Failed to lookup "+e+" in: "+t,r})},getTemplate:function(e,t){return"undefined"==typeof XMLHttpRequest?this.getTemplateFromFile(e,t):this.getTemplateFromUrl(e,t)},getTemplateFromFile:function(e,t){var r=this;return c.extname(e)||(e+=this.options.extname),this.lookup(e,t).then(function(e){if(r.options.cache){var t=r.cache[e];return t?j.resolve(t):a(e).then(function(e){return r.parse(e)}).then(function(t){return r.cache[e]=t})}return a(e).then(function(t){return r.parse(t,e)})})},getTemplateFromUrl:function(e,t){var r,n=this;if(l.valid(e)?r=e:(l.extname(e)||(e+=this.options.extname),r=l.resolve(t||this.options.root,e)),this.options.cache){var s=this.cache[e];if(s)return j.resolve(s)}return new j(function(t,s){var i=new XMLHttpRequest;i.onload=function(){if(i.status>=200&&i.status<300){var r=n.parse(i.responseText);n.options.cache&&(n.cache[e]=r),t(r)}else s(new Error(i.statusText))},i.onerror=function(){s(new Error("An error occurred whilst sending the response."))},i.open("GET",r),i.send()})},express:function(e){e=e||{};var t=this;return function(r,n,o){i(Array.isArray(this.root)||s.isString(this.root),"illegal views root, are you using express.js?"),e.root=this.root,t.renderFile(r,n,e).then(function(e){return o(null,e)}).catch(function(e){return o(e)})}}};function E(e){var t;(e=s.assign({root:["."],cache:!1,extname:"",dynamicPartials:!0,trim_tag_right:!1,trim_tag_left:!1,trim_value_right:!1,trim_value_left:!1,greedy:!0,strict_filters:!1,strict_variables:!1},e)).root=(t=e.root,Array.isArray(t)?t:s.isString(t)?[t]:[]);var r=Object.create(b);return r.init(h(),g(e),e),r}E.lexical=p,E.isTruthy=v.isTruthy,E.isFalsy=v.isFalsy,E.evalExp=v.evalExp,E.evalValue=v.evalValue,E.Types={ParseError:x.ParseError,TokenizationEroor:x.TokenizationError,RenderBreakError:x.RenderBreakError,AssertionError:x.AssertionError},t.exports=E},{"./filters":1,"./src/filter.js":9,"./src/lexical.js":10,"./src/parser":12,"./src/render.js":13,"./src/scope":14,"./src/syntax.js":15,"./src/tag.js":16,"./src/tokenizer.js":17,"./src/util/assert.js":18,"./src/util/error.js":19,"./src/util/fs.js":20,"./src/util/promise.js":21,"./src/util/underscore.js":23,"./src/util/url.js":24,"./tags":36,"any-promise":3,path:7}],3:[function(e,t,r){"use strict";t.exports=e("./register")().Promise},{"./register":5}],4:[function(e,t,r){"use strict";var n="@@any-promise/REGISTRATION",s=null;t.exports=function(e,t){return function(r,i){r=r||null;var o=!1!==(i=i||{}).global;if(null===s&&o&&(s=e[n]||null),null!==s&&null!==r&&s.implementation!==r)throw new Error('any-promise already defined as "'+s.implementation+'". You can only register an implementation before the first call to require("any-promise") and an implementation cannot be changed');return null===s&&(s=null!==r&&void 0!==i.Promise?{Promise:i.Promise,implementation:r}:t(r),o&&(e[n]=s)),s}}},{}],5:[function(e,t,r){"use strict";t.exports=e("./loader")(window,function(){if(void 0===window.Promise)throw new Error("any-promise browser requires a polyfill or explicit registration e.g: require('any-promise/register/bluebird')");return{Promise:window.Promise,implementation:"window.Promise"}})},{"./loader":4}],6:[function(e,t,r){"use strict"},{}],7:[function(e,t,r){"use strict"},{}],8:[function(e,t,r){"use strict";var n,s,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};n=void 0,s=function(){return function(){var e=arguments.length;if(0===e)throw new Error("resolveUrl requires at least one argument; got none.");var t=document.createElement("base");if(t.href=arguments[0],1===e)return t.href;var r=document.getElementsByTagName("head")[0];r.insertBefore(t,r.firstChild);for(var n,s=document.createElement("a"),i=1;i<e;i++)s.href=arguments[i],n=s.href,t.href=n;return r.removeChild(t),n}},"object"===(void 0===r?"undefined":i(r))?t.exports=s():n.resolveUrl=s()},{}],9:[function(e,t,r){"use strict";var n=e("./lexical.js"),s=e("./syntax.js"),i=e("./util/assert.js"),o=e("./util/underscore.js"),u=new RegExp(""+n.value.source,"g");t.exports=function(e){e=o.assign({},e);var t={},r={render:function(e,t){var r=this.args.map(function(e){return s.evalValue(e,t)});return r.unshift(e),this.filter.apply(null,r)},parse:function(r){var s=n.filterLine.exec(r);i(s,"illegal filter: "+r);var o=s[1],a=s[2]||"",c=t[o];if("function"!=typeof c){if(e.strict_filters)throw new TypeError("undefined filter: "+o);return this.name=o,this.filter=function(e){return e},this.args=[],this}for(var l=[];s=u.exec(a.trim());){var f=s[0];new RegExp(f+"\\s*:","g").test(s.input)?l.push("'"+f+"'"):l.push(f)}return this.name=o,this.filter=c,this.args=l,this}};return{construct:function(e){return Object.create(r).parse(e)},register:function(e,r){t[e]=r},clear:function(){t={}}}}},{"./lexical.js":10,"./syntax.js":15,"./util/assert.js":18,"./util/underscore.js":23}],10:[function(e,t,r){"use strict";var n=new RegExp(/'[^']*'/.source+"|"+/"[^"]*"/.source),s=new RegExp("(?:"+n.source+"|[^'\"])*"),i=/-?\d+/,o=/-?\d+\.?\d*|\.?\d+/,u=/true|false/,a=/[\w-]+/,c=new RegExp("\\[(?:"+n.source+"|[\\w-\\.]+)\\]"),l=new RegExp("(?:"+n.source+"|"+u.source+"|"+o.source+")"),f=new RegExp(a.source+"(?:\\."+a.source+"|"+c.source+")*"),p=new RegExp("(?:"+f.source+"|"+o.source+")"),h=new RegExp("\\("+p.source+"\\.\\."+p.source+"\\)"),g=new RegExp("\\(("+p.source+")\\.\\.("+p.source+")\\)"),d=new RegExp("(?:"+f.source+"|"+l.source+"|"+h.source+")"),v=new RegExp("(?:"+a.source+")\\s*:\\s*(?:"+d.source+")"),m=new RegExp("("+a.source+")\\s*:\\s*("+d.source+")","g"),y=new RegExp("^\\s*("+a.source+")\\s*([\\s\\S]*)\\s*$"),j=new RegExp("^"+l.source+"$","i"),w=new RegExp("^"+f.source+"$"),x=new RegExp("^"+o.source+"$"),b=new RegExp("^"+u.source+"$","i"),E=new RegExp("^"+n.source+"$"),T=new RegExp("^"+g.source+"$"),S=new RegExp("^"+i.source+"$"),k=new RegExp("(?:"+a.source+"\\s*:\\s*)?"+d.source),R=new RegExp(k.source+"(\\s*,\\s*"+k.source+")*"),O=new RegExp(a.source+"(?:\\s*:\\s*"+R.source+")?","g"),M=new RegExp("("+a.source+")(?:\\s*:\\s*("+R.source+"))?"),_=new RegExp("^"+M.source+"$");t.exports={quoted:n,number:o,bool:u,literal:l,filter:O,integer:i,hash:v,hashCapture:m,range:h,rangeCapture:g,identifier:a,value:d,quoteBalanced:s,operators:[/\s+or\s+/,/\s+and\s+/,/==|!=|<=|>=|<|>|\s+contains\s+/],quotedLine:E,numberLine:x,boolLine:b,rangeLine:T,literalLine:j,filterLine:_,tagLine:y,isLiteral:function(e){return j.test(e)},isVariable:function(e){return w.test(e)},parseLiteral:function(e){var t=e.match(x);if(t)return Number(e);if(t=e.match(b))return"true"===e.toLowerCase();if(t=e.match(E))return e.slice(1,-1);throw new TypeError("cannot parse '"+e+"' as literal")},isRange:function(e){return T.test(e)},matchValue:function(e){return d.exec(e)},isInteger:function(e){return S.test(e)}}},{}],11:[function(e,t,r){"use strict";t.exports=function(e){return{"==":function(e,t){return e===t},"!=":function(e,t){return e!==t},">":function(e,t){return null!==e&&null!==t&&e>t},"<":function(e,t){return null!==e&&null!==t&&e<t},">=":function(e,t){return null!==e&&null!==t&&e>=t},"<=":function(e,t){return null!==e&&null!==t&&e<=t},contains:function(e,t){return!!e&&("function"==typeof e.indexOf&&e.indexOf(t)>-1)},and:function(t,r){return e(t)&&e(r)},or:function(t,r){return e(t)||e(r)}}}},{}],12:[function(e,t,r){"use strict";var n=e("./lexical.js"),s=e("./util/error.js").ParseError,i=e("./util/assert.js");t.exports=function(e,t){var r={init:function(e){return this.tokens=e,this.handlers={},this},on:function(e,t){return this.handlers[e]=t,this},trigger:function(e,t){var r=this.handlers[e];if("function"==typeof r)return r(t),!0},start:function(){var e;for(this.trigger("start");!this.stopRequested&&(e=this.tokens.shift());)if(!(this.trigger("token",e)||"tag"===e.type&&this.trigger("tag:"+e.name,e))){var t=o(e,this.tokens);this.trigger("template",t)}return this.stopRequested||this.trigger("end"),this},stop:function(){return this.stopRequested=!0,this}};function o(e,t){try{var r=null;return(r="tag"===e.type?u(e,t):"value"===e.type?a(e.value):e).token=e,r}catch(t){throw new s(t,e)}}function u(t,r){return"continue"===t.name||"break"===t.name?t:e.construct(t,r)}function a(e){var r=n.matchValue(e);i(r,"illegal value string: "+e);var s=r[0];e=e.substr(r.index+r[0].length);for(var o=[];r=n.filter.exec(e);)o.push([r[0].trim()]);return{type:"value",initial:s,filters:o.map(function(e){return t.construct(e)})}}return{parse:function(e){for(var t,r=[];t=e.shift();)r.push(o(t,e));return r},parseTag:u,parseStream:function(e){return Object.create(r).init(e)},parseValue:a}}},{"./lexical.js":10,"./util/assert.js":18,"./util/error.js":19}],13:[function(e,t,r){"use strict";var n=e("./syntax.js"),s=e("any-promise"),i=e("./util/promise.js").mapSeries,o=e("./util/error.js").RenderBreakError,u=e("./util/error.js").RenderError,a=e("./util/assert.js"),c={renderTemplates:function(e,t){var r=this;a(t,"unable to evalTemplates: scope undefined");var n="";return i(e,function(e){return function(e){var r=this;return"tag"===e.type?this.renderTag(e,t).then(function(e){return void 0===e?"":e}):"value"===e.type?s.resolve().then(function(){return r.evalValue(e,t)}).then(function(e){return void 0===e?"":"string"==typeof(t=e)?t:JSON.stringify(t);var t}):s.resolve(e.value)}.call(r,e).then(function(e){return n+=e}).catch(function(t){if(t instanceof o)throw t.resolvedHTML=n,t;throw new u(t,e)})}).then(function(){return n})},renderTag:function(e,t){return"continue"===e.name?s.reject(new o("continue")):"break"===e.name?s.reject(new o("break")):e.render(t)},evalValue:function(e,t){return a(t,"unable to evalValue: scope undefined"),e.filters.reduce(function(e,r){return r.render(e,t)},n.evalExp(e.initial,t))}};t.exports=function(){return Object.create(c)}},{"./syntax.js":15,"./util/assert.js":18,"./util/error.js":19,"./util/promise.js":21,"any-promise":3}],14:[function(e,t,r){"use strict";var n=e("./util/underscore.js"),s=e("./lexical.js"),i=e("./util/assert.js"),o={getAll:function(){for(var e={},t=this.scopes.length-1;t>=0;t--)n.assign(e,this.scopes[t]);return e},get:function(e){try{return this.getPropertyByPath(this.scopes,e)}catch(e){if(!/undefined variable/.test(e.message)||this.opts.strict_variables)throw e}},set:function(e,t){return function(e,t,r){for(var s=(t+"").replace(/\[/g,".").replace(/\]/g,"").split("."),i=0;i<s.length;i++){var o=s[i];if(!n.isObject(e))return;if(i===s.length-1)return e[o]=r;void 0===e[o]&&(e[o]={}),e=e[o]}}(this.findScopeFor(e),e,t),this},push:function(e){return i(e,"trying to push "+e+" into scopes"),this.scopes.push(e)},pop:function(){return this.scopes.pop()},findScopeFor:function(e){for(var t=this.scopes.length-1;t>=0&&!(e in this.scopes[t]);)t--;return t<0&&(t=this.scopes.length-1),this.scopes[t]},unshift:function(e){return i(e,"trying to push "+e+" into scopes"),this.scopes.unshift(e)},shift:function(){return this.scopes.shift()},getPropertyByPath:function(e,t){var r=this.propertyAccessSeq(t+"");if(!r.length)throw new TypeError("undefined variable: "+t);var s=function(e,t){for(var r=t.length-1;r>-1;r--){var n=t[r];if(n.hasOwnProperty(e))return n[e]}throw new TypeError("undefined variable: "+e)}(r.shift(),e);return r.reduce(function(e,t){if(n.isNil(e))throw new TypeError("undefined variable: "+t);return s=e,"size"===(r=t)&&(n.isArray(s)||n.isString(s))?s.length:s[r];var r,s},s)},propertyAccessSeq:function(e){for(var t,r=[],n="",o=0;o<e.length;)switch(e[o]){case"[":c();var a=e[o+1];/['"]/.test(a)?(t=e.indexOf(a,o+2),i(-1!==t,"unbalanced "+a+": "+e),n=e.slice(o+2,t),c(),o=t+2):(t=u(e,o+1),i(-1!==t,"unbalanced []: "+e),n=e.slice(o+1,t),s.isInteger(n)||(n=this.get(n)),c(),o=t+1);break;case".":c(),o++;break;default:n+=e[o],o++}return c(),r;function c(){n.length&&r.push(n),n=""}}};function u(e,t){for(var r=1,n=t;n<e.length;n++)if("["===e[n]&&r++,"]"===e[n]&&0===--r)return n;return-1}r.factory=function(e,t){var r=Object.create(o);return r.opts=n.assign({dynamicPartials:!0,strict_variables:!1,strict_filters:!1,blocks:{},root:[]},t),r.scopes=[e||{}],r}},{"./lexical.js":10,"./util/assert.js":18,"./util/underscore.js":23}],15:[function(e,t,r){"use strict";var n=e("./operators.js")(u),s=e("./lexical.js"),i=e("../src/util/assert.js");function o(e,t){if(e=e&&e.trim()){if(s.isLiteral(e))return s.parseLiteral(e);if(s.isVariable(e))return t.get(e);throw new TypeError("cannot eval '"+e+"' as value")}}function u(e){return!a(e)}function a(e){return!1===e||void 0===e||null===e}t.exports={evalExp:function e(t,r){i(r,"unable to evalExp: scope undefined");for(var u,a=s.operators,c=0;c<a.length;c++){var l=a[c],f=new RegExp("^("+s.quoteBalanced.source+")("+l.source+")("+s.quoteBalanced.source+")$");if(u=t.match(f)){var p=e(u[1],r);return(0,n[u[2].trim()])(p,e(u[3],r))}}if(u=t.match(s.rangeLine)){for(var h=o(u[1],r),g=o(u[2],r),d=[],v=h;v<=g;v++)d.push(v);return d}return o(t,r)},evalValue:o,isTruthy:u,isFalsy:a}},{"../src/util/assert.js":18,"./lexical.js":10,"./operators.js":11}],16:[function(e,t,r){"use strict";var n=e("./lexical.js"),s=e("any-promise"),i=e("./syntax.js"),o=e("./util/assert.js");t.exports=function(){var e={},t={render:function(e){var t=function(e,t){var r,s={};for(n.hashCapture.lastIndex=0;r=n.hashCapture.exec(e);){var o=r[1],u=r[2];s[o]=i.evalValue(u,t)}return s}(this.token.args,e),r=this.tagImpl;return"function"!=typeof r.render?s.resolve(""):s.resolve().then(function(){return r.render(e,t)})},parse:function(t,r){this.type="tag",this.token=t,this.name=t.name;var n=e[this.name];o(n,"tag "+this.name+" not found"),this.tagImpl=Object.create(n),this.tagImpl.parse&&this.tagImpl.parse(t,r)}};return{construct:function(e,r){var n=Object.create(t);return n.parse(e,r),n},register:function(t,r){e[t]=r},clear:function(){e={}}}}},{"./lexical.js":10,"./syntax.js":15,"./util/assert.js":18,"any-promise":3}],17:[function(e,t,r){"use strict";var n=e("./lexical.js"),s=e("./util/error.js").TokenizationError,i=e("./util/underscore.js"),o=e("./whitespace-ctrl.js"),u=e("./util/assert.js");r.parse=function(e,t,r){u(i.isString(e),"illegal input");for(var a,c,l,f,p,h,g,d=/({%-?([\s\S]*?)-?%})|({{-?([\s\S]*?)-?}})/g,v=0,m=(a=e,c=0,l=-1,{get:function(e){var t=a.slice(l+1,e).split("\n");return c+=t.length-1,l=e,c+1}}),y=0,j=[];f=d.exec(e);y=d.lastIndex)f.index>y&&j.push(x(y,f.index)),j.push(f[1]?w(f[1],f[2].trim(),f.index):(p=f[3],h=f[4].trim(),g=f.index,{type:"value",line:m.get(g),trim_left:"{{-"===p.slice(0,3),trim_right:"-}}"===p.slice(-3),raw:p,value:h,input:e,file:t}));return e.length>y&&j.push(x(y,e.length)),o(j,r),j;function w(r,i,o){var u=i.match(n.tagLine),a={type:"tag",indent:v,line:m.get(o),trim_left:"{%-"===r.slice(0,3),trim_right:"-%}"===r.slice(-3),raw:r,value:i,input:e,file:t};if(!u)throw new s("illegal tag syntax",a);return a.name=u[1],a.args=u[2],a}function x(t,r){var n=e.slice(t,r);return v=i.last(n.split("\n")).length,{type:"html",raw:n,value:n}}},r.whiteSpaceCtrl=o},{"./lexical.js":10,"./util/assert.js":18,"./util/error.js":19,"./util/underscore.js":23,"./whitespace-ctrl.js":25}],18:[function(e,t,r){"use strict";var n=e("./error.js").AssertionError;t.exports=function(e,t){if(!e)throw new n(t=t||"expect "+e+" to be true")}},{"./error.js":19}],19:[function(e,t,r){"use strict";var n=e("./underscore.js");function s(){this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}function i(e,t){s.call(this),this.input=t.input,this.line=t.line,this.file=t.file;var r,i,o,u,a,c=(r=t.input,i=t.line,o=r.split("\n"),u=Math.max(i-2,1),a=Math.min(i+3,o.length),n.range(u,a+1).map(function(e){return[e===i?">> ":" ",(t=e,r=a,n=t+"",Array((r+"").length-n.length).join(" ")+n),"| ",o[e-1]].join("");var t,r,n}).join("\n"));this.message=function(e,t){e=e||"",t.file&&(e+=", file:"+t.file);t.line&&(e+=", line:"+t.line);return e}(e.message,t),this.stack=c+"\n"+(this.stack||this.message)+(e.stack?"\nFrom "+e.stack:"")}function o(e,t){i.call(this,{message:e},t)}function u(e,t){n.assign(this,e),this.originalError=e,i.call(this,e,t)}function a(e,t){if(e instanceof a)return e;n.assign(this,e),this.originalError=e,i.call(this,e,t.token)}function c(e){s.call(this),this.message=e+""}function l(e){s.call(this),this.message=e+""}o.prototype=Object.create(Error.prototype),o.prototype.constructor=o,u.prototype=Object.create(Error.prototype),u.prototype.constructor=u,a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,c.prototype=Object.create(Error.prototype),c.prototype.constructor=c,l.prototype=Object.create(Error.prototype),l.prototype.constructor=l,t.exports={TokenizationError:o,ParseError:u,RenderBreakError:c,AssertionError:l,RenderError:a}},{"./underscore.js":23}],20:[function(e,t,r){"use strict";var n=e("fs");t.exports={readFileAsync:function(e){return new Promise(function(t,r){n.readFile(e,"utf8",function(e,n){e?r(e):t(n)})})},statFileAsync:function(e){return new Promise(function(t,r){n.stat(e,function(e,n){return e?r(e):t(n)})})}}},{fs:6}],21:[function(e,t,r){"use strict";var n=e("any-promise");r.anySeries=function(e,t){var r=n.reject(new Error("init"));return e.forEach(function(n,s){r=r.catch(function(r){return t(n,s,e)})}),r},r.mapSeries=function(e,t){var r=n.resolve("init"),s=[];return e.forEach(function(n,i){r=r.then(function(){return t(n,i,e)}).then(function(e){return s.push(e)})}),r.then(function(){return s})}},{"any-promise":3}],22:[function(e,t,r){"use strict";var n=["January","February","March","April","May","June","July","August","September","October","November","December"],s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],i=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],o=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],u={1:"st",2:"nd",3:"rd",default:"th"},a={daysInMonth:function(e){return[31,a.isLeapYear(e)?29:28,31,30,31,30,31,31,30,31,30,31]},getDayOfYear:function(e){for(var t=0,r=0;r<e.getMonth();++r)t+=a.daysInMonth(e)[r];return t+e.getDate()},getWeekOfYear:function(e,t){var r=this.getDayOfYear(e)+(t-e.getDay()),n=7-new Date(e.getFullYear(),0,1).getDay()+t;return c.pad(Math.floor((r-n)/7)+1,2)},isLeapYear:function(e){var t=e.getFullYear();return!(0!=(3&t)||!(t%100||t%400==0&&t))},getSuffix:function(e){var t=e.getDate().toString(),r=parseInt(t.slice(-1));return u[r]||u.default},century:function(e){return parseInt(e.getFullYear().toString().substring(0,2),10)}},c={pad:function(e,t,r){r||(r="0");for(var n=e.toString(),s=t-n.length;s-- >0;)n=r+n;return n}},l={a:function(e){return o[e.getDay()]},A:function(e){return i[e.getDay()]},b:function(e){return s[e.getMonth()]},B:function(e){return n[e.getMonth()]},c:function(e){return e.toLocaleString()},C:function(e){return a.century(e)},d:function(e){return c.pad(e.getDate(),2)},e:function(e){return c.pad(e.getDate(),2," ")},H:function(e){return c.pad(e.getHours(),2)},I:function(e){return c.pad(e.getHours()%12||12,2)},j:function(e){return c.pad(a.getDayOfYear(e),3)},k:function(e){return c.pad(e.getHours(),2," ")},l:function(e){return c.pad(e.getHours()%12||12,2," ")},L:function(e){return c.pad(e.getMilliseconds(),3)},m:function(e){return c.pad(e.getMonth()+1,2)},M:function(e){return c.pad(e.getMinutes(),2)},p:function(e){return e.getHours()<12?"AM":"PM"},P:function(e){return e.getHours()<12?"am":"pm"},q:function(e){return a.getSuffix(e)},s:function(e){return Math.round(e.valueOf()/1e3)},S:function(e){return c.pad(e.getSeconds(),2)},u:function(e){return e.getDay()||7},U:function(e){return a.getWeekOfYear(e,0)},w:function(e){return e.getDay()},W:function(e){return a.getWeekOfYear(e,1)},x:function(e){return e.toLocaleDateString()},X:function(e){return e.toLocaleTimeString()},y:function(e){return e.getFullYear().toString().substring(2,4)},Y:function(e){return e.getFullYear()},z:function(e){var t=e.getTimezoneOffset()/60*100;return(t>0?"-":"+")+c.pad(Math.abs(t),4)},"%":function(){return"%"}};l.h=l.b,l.N=l.L;t.exports=function(e,t){for(var r="",n=t;;){var s=/%./g,i=s.exec(n);if(!i)return r+n;r+=n.slice(0,s.lastIndex-2),n=n.slice(s.lastIndex);var o=i[0].charAt(1),u=l[o];r+=u?u.call(this,e):"%"+o}}},{}],23:[function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=Object.prototype.toString;function i(e,t){e=e||{};for(var r in e)if(e.hasOwnProperty(r)&&!1===t(e[r],r,e))break;return e}function o(e){var t=void 0===e?"undefined":n(e);return null!=e&&("object"===t||"function"===t)}r.isString=function(e){return e instanceof String||"string"==typeof e},r.isObject=o,r.isArray=function(e){return"[object Array]"===s.call(e)},r.isNil=function(e){return null===e||void 0===e},r.isError=function(e){return"Error"===Object.prototype.toString.call(e).substr(-6,5)||"string"==typeof e.message&&"string"==typeof e.name},r.range=function(e,t,r){1===arguments.length&&(t=e,e=0),r=r||1;for(var n=[],s=e;s<t;s+=r)n.push(s);return n},r.last=function(e){return e[e.length-1]},r.forOwn=i,r.assign=function(e){return e=o(e)?e:{},Array.prototype.slice.call(arguments,1).forEach(function(t){var r;r=e,i(t,function(e,t){r[t]=e})}),e},r.uniq=function(e){for(var t={},r=[],n=0,s=e.length;n<s;++n)t.hasOwnProperty(e[n])||(r.push(e[n]),t[e[n]]=1);return r}},{}],24:[function(e,t,r){"use strict";var n=e("resolve-url"),s=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^/]+?|)(\.[^./]*|))(?:[/]*)$/,i=/^(?:\w+:)?\/\/([^\s.]+\.\S{2}|localhost[:?\d]*)\S*$/;r.extname=function(e){return s.exec(e).slice(1)[3]},r.valid=function(e){return i.test(e)},r.resolve=function(e,t){return"[object Array]"===Object.prototype.toString.call(e)&&(e=e[0]),e&&"/"!==e.charAt(e.length-1)&&(e+="/"),n(e,t)}},{"resolve-url":8}],25:[function(e,t,r){"use strict";var n=e("./util/underscore.js");t.exports=function(e,t){t=n.assign({greedy:!0},t);var r=!1;e.forEach(function(n,s){var i,o,u,a;u=n,a=t,!r&&("tag"===u.type?u.trim_left||a.trim_tag_left:"value"===u.type?u.trim_left||a.trim_value_left:void 0)&&function(e,t){if(e&&"html"===e.type){var r=t?/\s+$/g:/[\t\r ]*$/g;e.value=e.value.replace(r,"")}}(e[s-1],t.greedy),"tag"===n.type&&"raw"===n.name&&(r=!0),"tag"===n.type&&"endraw"===n.name&&(r=!1),i=n,o=t,!r&&("tag"===i.type?i.trim_right||o.trim_tag_right:"value"===i.type?i.trim_right||o.trim_value_right:void 0)&&function(e,t){if(e&&"html"===e.type){var r=t?/^\s+/g:/^[\t\r ]*\n?/g;e.value=e.value.replace(r,"")}}(e[s+1],t.greedy)})}},{"./util/underscore.js":23}],26:[function(e,t,r){"use strict";var n=e("..").lexical,s=e("any-promise"),i=new RegExp("("+n.identifier.source+")\\s*=(.*)"),o=e("../src/util/assert.js");t.exports=function(e){e.registerTag("assign",{parse:function(e){var t=e.args.match(i);o(t,"illegal token "+e.raw),this.key=t[1],this.value=t[2]},render:function(t){return t.set(this.key,e.evalValue(this.value,t)),s.resolve("")}})}},{"..":2,"../src/util/assert.js":18,"any-promise":3}],27:[function(e,t,r){"use strict";var n=e("..").lexical,s=new RegExp("("+n.identifier.source+")"),i=e("../src/util/assert.js");t.exports=function(e){e.registerTag("capture",{parse:function(t,r){var n=this,o=t.args.match(s);i(o,t.args+" not valid identifier"),this.variable=o[1],this.templates=[];var u=e.parser.parseStream(r);u.on("tag:endcapture",function(e){return u.stop()}).on("template",function(e){return n.templates.push(e)}).on("end",function(e){throw new Error("tag "+t.raw+" not closed")}),u.start()},render:function(t,r){var n=this;return e.renderer.renderTemplates(this.templates,t).then(function(e){t.set(n.variable,e)})}})}},{"..":2,"../src/util/assert.js":18}],28:[function(e,t,r){"use strict";var n=e("..");t.exports=function(e){e.registerTag("case",{parse:function(t,r){var n=this;this.cond=t.args,this.cases=[],this.elseTemplates=[];var s=[],i=e.parser.parseStream(r).on("tag:when",function(e){n.cases.push({val:e.args,templates:s=[]})}).on("tag:else",function(){return s=n.elseTemplates}).on("tag:endcase",function(e){return i.stop()}).on("template",function(e){return s.push(e)}).on("end",function(e){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t,r){for(var s=0;s<this.cases.length;s++){var i=this.cases[s];if(n.evalExp(i.val,t)===n.evalExp(this.cond,t))return e.renderer.renderTemplates(i.templates,t)}return e.renderer.renderTemplates(this.elseTemplates,t)}})}},{"..":2}],29:[function(e,t,r){"use strict";t.exports=function(e){e.registerTag("comment",{parse:function(t,r){var n=e.parser.parseStream(r);n.on("token",function(e){"endcomment"===e.name&&n.stop()}).on("end",function(e){throw new Error("tag "+t.raw+" not closed")}),n.start()}})}},{}],30:[function(e,t,r){"use strict";var n=e(".."),s=e("any-promise"),i=n.lexical,o=new RegExp("^(?:("+i.value.source+")\\s*:\\s*)?(.*)$"),u=new RegExp(i.value.source,"g"),a=e("../src/util/assert.js");t.exports=function(e){e.registerTag("cycle",{parse:function(e,t){var r=o.exec(e.args);a(r,"illegal tag: "+e.raw),this.group=r[1]||"";var n=r[2];for(this.candidates=[];r=u.exec(n);)this.candidates.push(r[0]);a(this.candidates.length,"empty candidates: "+e.raw)},render:function(e,t){var r="cycle:"+n.evalValue(this.group,e)+":"+this.candidates.join(","),i=e.opts.groups=e.opts.groups||{},o=i[r];void 0===o&&(o=i[r]=0);var u=this.candidates[o];return o=(o+1)%this.candidates.length,i[r]=o,s.resolve(n.evalValue(u,e))}})}},{"..":2,"../src/util/assert.js":18,"any-promise":3}],31:[function(e,t,r){"use strict";var n=e("..").lexical,s=e("../src/util/assert.js");t.exports=function(e){e.registerTag("decrement",{parse:function(e){var t=e.args.match(n.identifier);s(t,"illegal identifier "+e.args),this.variable=t[0]},render:function(e,t){var r=e.get(this.variable);"number"!=typeof r&&(r=0),e.set(this.variable,r-1)}})}},{"..":2,"../src/util/assert.js":18}],32:[function(e,t,r){"use strict";var n=e(".."),s=n.lexical,i=e("../src/util/promise.js").mapSeries,o=e("../src/util/underscore.js"),u=n.Types.RenderBreakError,a=e("../src/util/assert.js"),c=new RegExp("^("+s.identifier.source+")\\s+in\\s+("+s.value.source+")(?:\\s+"+s.hash.source+")*(?:\\s+(reversed))?(?:\\s+"+s.hash.source+")*$");t.exports=function(e){e.registerTag("for",{parse:function(t,r){var n,s=this,i=c.exec(t.args);a(i,"illegal tag: "+t.raw),this.variable=i[1],this.collection=i[2],this.reversed=!!i[3],this.templates=[],this.elseTemplates=[];var o=e.parser.parseStream(r).on("start",function(){return n=s.templates}).on("tag:else",function(){return n=s.elseTemplates}).on("tag:endfor",function(){return o.stop()}).on("template",function(e){return n.push(e)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});o.start()},render:function(t,r){var s=this,a=n.evalExp(this.collection,t);if(Array.isArray(a)||(o.isString(a)&&a.length>0?a=[a]:o.isObject(a)&&(a=Object.keys(a).map(function(e){return[e,a[e]]}))),!Array.isArray(a)||!a.length)return e.renderer.renderTemplates(this.elseTemplates,t);var c=a.length,l=r.offset||0,f=void 0===r.limit?a.length:r.limit;a=a.slice(l,l+f),this.reversed&&a.reverse();var p=a.map(function(e,t){var r={};return r[s.variable]=e,r.forloop={first:0===t,index:t+1,index0:t,last:t===c-1,length:c,rindex:c-t,rindex0:c-t-1},r}),h="";return i(p,function(r){return Promise.resolve().then(function(){return t.push(r)}).then(function(){return e.renderer.renderTemplates(s.templates,t)}).then(function(e){return h+=e}).catch(function(e){if(!(e instanceof u&&(h+=e.resolvedHTML,"continue"===e.message)))throw e}).then(function(){return t.pop()})}).catch(function(e){if(!(e instanceof u&&"break"===e.message))throw e}).then(function(){return h})}})}},{"..":2,"../src/util/assert.js":18,"../src/util/promise.js":21,"../src/util/underscore.js":23}],33:[function(e,t,r){"use strict";var n=e("..");t.exports=function(e){e.registerTag("if",{parse:function(t,r){var n,s=this;this.branches=[],this.elseTemplates=[];var i=e.parser.parseStream(r).on("start",function(){return s.branches.push({cond:t.args,templates:n=[]})}).on("tag:elsif",function(e){s.branches.push({cond:e.args,templates:n=[]})}).on("tag:else",function(){return n=s.elseTemplates}).on("tag:endif",function(e){return i.stop()}).on("template",function(e){return n.push(e)}).on("end",function(e){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t,r){for(var s=0;s<this.branches.length;s++){var i=this.branches[s],o=n.evalExp(i.cond,t);if(n.isTruthy(o))return e.renderer.renderTemplates(i.templates,t)}return e.renderer.renderTemplates(this.elseTemplates,t)}})}},{"..":2}],34:[function(e,t,r){"use strict";var n=e(".."),s=n.lexical,i=new RegExp("with\\s+("+s.value.source+")"),o=/\S+/,u=e("../src/util/assert.js");t.exports=function(e){e.registerTag("include",{parse:function(e){var t=o.exec(e.args);t&&(this.staticValue=t[0]),(t=s.value.exec(e.args))&&(this.value=t[0]),(t=i.exec(e.args))&&(this.with=t[1])},render:function(t,r){var s=t.opts.dynamicPartials?n.evalValue(this.value,t):this.staticValue;u(s,"cannot include with empty filename");var i=t.opts.blocks,o=t.opts.blockMode;return t.opts.blocks={},t.opts.blockMode="output",this.with&&(r[s]=n.evalValue(this.with,t)),e.getTemplate(s,t.opts.root).then(function(n){return t.push(r),e.renderer.renderTemplates(n,t)}).then(function(e){return t.pop(),t.opts.blocks=i,t.opts.blockMode=o,e})}})}},{"..":2,"../src/util/assert.js":18}],35:[function(e,t,r){"use strict";var n=e(".."),s=e("../src/util/assert.js"),i=n.lexical;t.exports=function(e){e.registerTag("increment",{parse:function(e){var t=e.args.match(i.identifier);s(t,"illegal identifier "+e.args),this.variable=t[0]},render:function(e,t){var r=e.get(this.variable);"number"!=typeof r&&(r=0),e.set(this.variable,r+1)}})}},{"..":2,"../src/util/assert.js":18}],36:[function(e,t,r){"use strict";t.exports=function(t){e("./assign.js")(t),e("./capture.js")(t),e("./case.js")(t),e("./comment.js")(t),e("./cycle.js")(t),e("./decrement.js")(t),e("./for.js")(t),e("./if.js")(t),e("./include.js")(t),e("./increment.js")(t),e("./layout.js")(t),e("./raw.js")(t),e("./tablerow.js")(t),e("./unless.js")(t)}},{"./assign.js":26,"./capture.js":27,"./case.js":28,"./comment.js":29,"./cycle.js":30,"./decrement.js":31,"./for.js":32,"./if.js":33,"./include.js":34,"./increment.js":35,"./layout.js":37,"./raw.js":38,"./tablerow.js":39,"./unless.js":40}],37:[function(e,t,r){"use strict";var n=e(".."),s=e("any-promise"),i=n.lexical,o=e("../src/util/assert.js"),u=/\S+/;t.exports=function(e){e.registerTag("layout",{parse:function(t,r){var n=u.exec(t.args);n&&(this.staticLayout=n[0]),(n=i.value.exec(t.args))&&(this.layout=n[0]),this.tpls=e.parser.parse(r)},render:function(t,r){var s=t.opts.dynamicPartials?n.evalValue(this.layout,t):this.staticLayout;return o(s,"cannot apply layout with empty filename"),t.opts.blockMode="store",e.renderer.renderTemplates(this.tpls,t).then(function(r){return void 0===t.opts.blocks[""]&&(t.opts.blocks[""]=r),e.getTemplate(s,t.opts.root)}).then(function(n){return t.push(r),t.opts.blockMode="output",e.renderer.renderTemplates(n,t)}).then(function(e){return t.pop(),e})}}),e.registerTag("block",{parse:function(t,r){var n=this,s=/\w+/.exec(t.args);this.block=s?s[0]:"",this.tpls=[];var i=e.parser.parseStream(r).on("tag:endblock",function(){return i.stop()}).on("template",function(e){return n.tpls.push(e)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t){var r=this;return s.resolve(t.opts.blocks[this.block]).then(function(n){return void 0===n?e.renderer.renderTemplates(r.tpls,t):n}).then(function(e){return"store"===t.opts.blockMode?(t.opts.blocks[r.block]=e,""):e})}})}},{"..":2,"../src/util/assert.js":18,"any-promise":3}],38:[function(e,t,r){"use strict";var n=e("any-promise");t.exports=function(e){e.registerTag("raw",{parse:function(t,r){var n=this;this.tokens=[];var s=e.parser.parseStream(r);s.on("token",function(e){"endraw"===e.name?s.stop():n.tokens.push(e)}).on("end",function(e){throw new Error("tag "+t.raw+" not closed")}),s.start()},render:function(e,t){var r=this.tokens.map(function(e){return e.raw}).join("");return n.resolve(r)}})}},{"any-promise":3}],39:[function(e,t,r){"use strict";var n=e(".."),s=e("../src/util/promise.js").mapSeries,i=n.lexical,o=e("../src/util/assert.js"),u=new RegExp("^("+i.identifier.source+")\\s+in\\s+("+i.value.source+")(?:\\s+"+i.hash.source+")*$");t.exports=function(e){e.registerTag("tablerow",{parse:function(t,r){var n,s=this,i=u.exec(t.args);o(i,"illegal tag: "+t.raw),this.variable=i[1],this.collection=i[2],this.templates=[];var a=e.parser.parseStream(r).on("start",function(){return n=s.templates}).on("tag:endtablerow",function(e){return a.stop()}).on("template",function(e){return n.push(e)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});a.start()},render:function(t,r){var i,o,u=this,a=n.evalExp(this.collection,t)||[],c="<table>",l=r.offset||0,f=void 0===r.limit?a.length:r.limit,p=r.cols;if(!p)throw new Error("illegal cols: "+p);var h=[];return(a=a.slice(l,l+f)).some(function(e,t){var r={};r[u.variable]=e,h.push(r)}),s(h,function(r,n){return i=Math.floor(n/p)+1,1===(o=n%p+1)&&(1!==i&&(c+="</tr>"),c+='<tr class="row'+i+'">'),c+='<td class="col'+o+'">',t.push(r),e.renderer.renderTemplates(u.templates,t).then(function(e){return t.pop(r),c+=e,c+="</td>"})}).then(function(){return i>0&&(c+="</tr>"),c+="</table>"})}})}},{"..":2,"../src/util/assert.js":18,"../src/util/promise.js":21}],40:[function(e,t,r){"use strict";var n=e("..");t.exports=function(e){e.registerTag("unless",{parse:function(t,r){var n,s=this;this.templates=[],this.elseTemplates=[];var i=e.parser.parseStream(r).on("start",function(e){n=s.templates,s.cond=t.args}).on("tag:else",function(){return n=s.elseTemplates}).on("tag:endunless",function(e){return i.stop()}).on("template",function(e){return n.push(e)}).on("end",function(e){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t,r){var s=n.evalExp(this.cond,t);return n.isFalsy(s)?e.renderer.renderTemplates(this.templates,t):e.renderer.renderTemplates(this.elseTemplates,t)}})}},{"..":2}]},{},[2])(2)});
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Liquid=e()}}(function(){return function e(t,r,n){function s(o,u){if(!r[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[o]={exports:{}};t[o][0].call(l.exports,function(e){var r=t[o][1][e];return s(r||e)},l,l.exports,e,t,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o<n.length;o++)s(n[o]);return s}({1:[function(e,t,r){"use strict";var n=e("./src/util/strftime.js"),s=e("./src/util/underscore.js"),i=e("./src/syntax.js").isTruthy,o={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&#34;","'":"&#39;"},u={"&amp;":"&","&lt;":"<","&gt;":">","&#34;":'"',"&#39;":"'"},a={abs:function(e){return Math.abs(e)},append:function(e,t){return e+t},capitalize:function(e){return f(e).charAt(0).toUpperCase()+e.slice(1)},ceil:function(e){return Math.ceil(e)},concat:function(e,t){return Array.prototype.concat.call(e,t)},date:function(e,t){var r,i=e;return"now"===e?i=new Date:s.isString(e)&&(i=new Date(e)),(r=i)instanceof Date&&!isNaN(r.getTime())?n(i,t):e},default:function(e,t){return i(e)?e:t},divided_by:function(e,t){return Math.floor(e/t)},downcase:function(e){return e.toLowerCase()},escape:c,escape_once:function(e){return c(f(e).replace(/&(amp|lt|gt|#34|#39);/g,function(e){return u[e]}))},first:function(e){return e[0]},floor:function(e){return Math.floor(e)},join:function(e,t){return e.join(t)},last:function(e){return e[e.length-1]},lstrip:function(e){return f(e).replace(/^\s+/,"")},map:function(e,t){return e.map(function(e){return e[t]})},minus:p(function(e,t){return e-t}),modulo:p(function(e,t){return e%t}),newline_to_br:function(e){return e.replace(/\n/g,"<br />")},plus:p(function(e,t){return Number(e)+Number(t)}),prepend:function(e,t){return t+e},remove:function(e,t){return e.split(t).join("")},remove_first:function(e,t){return e.replace(t,"")},replace:function(e,t,r){return f(e).split(t).join(r)},replace_first:function(e,t,r){return f(e).replace(t,r)},reverse:function(e){return e.reverse()},round:function(e,t){var r=Math.pow(10,t||0);return Math.round(e*r,t)/r},rstrip:function(e){return f(e).replace(/\s+$/,"")},size:function(e){return e.length},slice:function(e,t,r){return e.substr(t,void 0===r?1:r)},sort:function(e,t){return e.sort(t)},split:function(e,t){return f(e).split(t)},strip:function(e){return f(e).trim()},strip_html:function(e){return f(e).replace(/<\/?\s*\w+\s*\/?>/g,"")},strip_newlines:function(e){return f(e).replace(/\n/g,"")},times:function(e,t){return e*t},truncate:function(e,t,r){return e=f(e),r=void 0===r?"...":r,t=t||16,e.length<=t?e:e.substr(0,t-r.length)+r},truncatewords:function(e,t,r){void 0===r&&(r="...");var n=e.split(" "),s=n.slice(0,t).join(" ");return n.length>t&&(s+=r),s},uniq:function(e){var t={};return(e||[]).filter(function(e){return!t.hasOwnProperty(e)&&(t[e]=!0,!0)})},upcase:function(e){return f(e).toUpperCase()},url_encode:encodeURIComponent};function c(e){return f(e).replace(/&|<|>|"|'/g,function(e){return o[e]})}function l(e){var t=(e+"").split(".");return t.length>1?t[1].length:0}function f(e){return e+""}function p(e){return function(t,r){var n,s,i=(n=t,s=r,Math.max(l(n),l(s)));return e(t,r).toFixed(i)}}function h(e){return s.forOwn(a,function(t,r){return e.registerFilter(r,t)})}h.filters=a,t.exports=h},{"./src/syntax.js":15,"./src/util/strftime.js":22,"./src/util/underscore.js":23}],2:[function(e,t,r){"use strict";var n=e("./src/scope"),s=e("./src/util/underscore.js"),i=e("./src/util/assert.js"),o=e("./src/tokenizer.js"),u=e("./src/util/fs.js").statFileAsync,a=e("./src/util/fs.js").readFileAsync,c=e("path"),l=e("./src/util/url.js"),f=e("./src/render.js"),p=e("./src/lexical.js"),h=e("./src/tag.js"),g=e("./src/filter.js"),d=e("./src/parser"),v=e("./src/syntax.js"),m=e("./tags"),y=e("./filters"),j=e("any-promise"),w=e("./src/util/promise.js").anySeries,x=e("./src/util/error.js"),b={init:function(e,t,r){return r.cache&&(this.cache={}),this.options=r,this.tag=e,this.filter=t,this.parser=d(e,t),this.renderer=f(),m(this),y(this),this},parse:function(e,t){var r=o.parse(e,t,this.options);return this.parser.parse(r)},render:function(e,t,r){r=s.assign({},this.options,r);var i=n.factory(t,r);return this.renderer.renderTemplates(e,i)},parseAndRender:function(e,t,r){var n=this;return j.resolve().then(function(){return n.parse(e)}).then(function(e){return n.render(e,t,r)})},renderFile:function(e,t,r){var n=this;return r=s.assign({},r),this.getTemplate(e,r.root).then(function(e){return n.render(e,t,r)})},evalValue:function(e,t){var r=this.parser.parseValue(e.trim());return this.renderer.evalValue(r,t)},registerFilter:function(e,t){return this.filter.register(e,t)},registerTag:function(e,t){return this.tag.register(e,t)},lookup:function(e,t){t=this.options.root.concat(t||[]);var r=(t=s.uniq(t)).map(function(t){return c.resolve(t,e)});return w(r,function(e){return u(e).then(function(){return e})}).catch(function(r){throw r.message=r.code+": Failed to lookup "+e+" in: "+t,r})},getTemplate:function(e,t){return"undefined"==typeof XMLHttpRequest?this.getTemplateFromFile(e,t):this.getTemplateFromUrl(e,t)},getTemplateFromFile:function(e,t){var r=this;return c.extname(e)||(e+=this.options.extname),this.lookup(e,t).then(function(e){if(r.options.cache){var t=r.cache[e];return t?j.resolve(t):a(e).then(function(e){return r.parse(e)}).then(function(t){return r.cache[e]=t})}return a(e).then(function(t){return r.parse(t,e)})})},getTemplateFromUrl:function(e,t){var r,n=this;if(l.valid(e)?r=e:(l.extname(e)||(e+=this.options.extname),r=l.resolve(t||this.options.root,e)),this.options.cache){var s=this.cache[e];if(s)return j.resolve(s)}return new j(function(t,s){var i=new XMLHttpRequest;i.onload=function(){if(i.status>=200&&i.status<300){var r=n.parse(i.responseText);n.options.cache&&(n.cache[e]=r),t(r)}else s(new Error(i.statusText))},i.onerror=function(){s(new Error("An error occurred whilst sending the response."))},i.open("GET",r),i.send()})},express:function(e){e=e||{};var t=this;return function(r,n,o){i(Array.isArray(this.root)||s.isString(this.root),"illegal views root, are you using express.js?"),e.root=this.root,t.renderFile(r,n,e).then(function(e){return o(null,e)}).catch(function(e){return o(e)})}}};function E(e){var t;(e=s.assign({root:["."],cache:!1,extname:"",dynamicPartials:!0,trim_tag_right:!1,trim_tag_left:!1,trim_value_right:!1,trim_value_left:!1,greedy:!0,strict_filters:!1,strict_variables:!1},e)).root=(t=e.root,Array.isArray(t)?t:s.isString(t)?[t]:[]);var r=Object.create(b);return r.init(h(),g(e),e),r}E.lexical=p,E.isTruthy=v.isTruthy,E.isFalsy=v.isFalsy,E.evalExp=v.evalExp,E.evalValue=v.evalValue,E.Types={ParseError:x.ParseError,TokenizationEroor:x.TokenizationError,RenderBreakError:x.RenderBreakError,AssertionError:x.AssertionError},t.exports=E},{"./filters":1,"./src/filter.js":9,"./src/lexical.js":10,"./src/parser":12,"./src/render.js":13,"./src/scope":14,"./src/syntax.js":15,"./src/tag.js":16,"./src/tokenizer.js":17,"./src/util/assert.js":18,"./src/util/error.js":19,"./src/util/fs.js":20,"./src/util/promise.js":21,"./src/util/underscore.js":23,"./src/util/url.js":24,"./tags":36,"any-promise":3,path:7}],3:[function(e,t,r){"use strict";t.exports=e("./register")().Promise},{"./register":5}],4:[function(e,t,r){"use strict";var n="@@any-promise/REGISTRATION",s=null;t.exports=function(e,t){return function(r,i){r=r||null;var o=!1!==(i=i||{}).global;if(null===s&&o&&(s=e[n]||null),null!==s&&null!==r&&s.implementation!==r)throw new Error('any-promise already defined as "'+s.implementation+'". You can only register an implementation before the first call to require("any-promise") and an implementation cannot be changed');return null===s&&(s=null!==r&&void 0!==i.Promise?{Promise:i.Promise,implementation:r}:t(r),o&&(e[n]=s)),s}}},{}],5:[function(e,t,r){"use strict";t.exports=e("./loader")(window,function(){if(void 0===window.Promise)throw new Error("any-promise browser requires a polyfill or explicit registration e.g: require('any-promise/register/bluebird')");return{Promise:window.Promise,implementation:"window.Promise"}})},{"./loader":4}],6:[function(e,t,r){"use strict"},{}],7:[function(e,t,r){"use strict"},{}],8:[function(e,t,r){"use strict";var n,s,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};n=void 0,s=function(){return function(){var e=arguments.length;if(0===e)throw new Error("resolveUrl requires at least one argument; got none.");var t=document.createElement("base");if(t.href=arguments[0],1===e)return t.href;var r=document.getElementsByTagName("head")[0];r.insertBefore(t,r.firstChild);for(var n,s=document.createElement("a"),i=1;i<e;i++)s.href=arguments[i],n=s.href,t.href=n;return r.removeChild(t),n}},"object"===(void 0===r?"undefined":i(r))?t.exports=s():n.resolveUrl=s()},{}],9:[function(e,t,r){"use strict";var n=e("./lexical.js"),s=e("./syntax.js"),i=e("./util/assert.js"),o=e("./util/underscore.js"),u=new RegExp(""+n.value.source,"g");t.exports=function(e){e=o.assign({},e);var t={},r={render:function(e,t){var r=this.args.map(function(e){return s.evalValue(e,t)});return r.unshift(e),this.filter.apply(null,r)},parse:function(r){var s=n.filterLine.exec(r);i(s,"illegal filter: "+r);var o=s[1],a=s[2]||"",c=t[o];if("function"!=typeof c){if(e.strict_filters)throw new TypeError("undefined filter: "+o);return this.name=o,this.filter=function(e){return e},this.args=[],this}for(var l=[];s=u.exec(a.trim());){var f=s[0],p=new RegExp(f+"\\s*:","g").exec(s.input);p&&p.index===s.index?l.push("'"+f+"'"):l.push(f)}return this.name=o,this.filter=c,this.args=l,this}};return{construct:function(e){return Object.create(r).parse(e)},register:function(e,r){t[e]=r},clear:function(){t={}}}}},{"./lexical.js":10,"./syntax.js":15,"./util/assert.js":18,"./util/underscore.js":23}],10:[function(e,t,r){"use strict";var n=new RegExp(/'[^']*'/.source+"|"+/"[^"]*"/.source),s=new RegExp("(?:"+n.source+"|[^'\"])*"),i=/-?\d+/,o=/-?\d+\.?\d*|\.?\d+/,u=/true|false/,a=/[\w-]+/,c=new RegExp("\\[(?:"+n.source+"|[\\w-\\.]+)\\]"),l=new RegExp("(?:"+n.source+"|"+u.source+"|"+o.source+")"),f=new RegExp(a.source+"(?:\\."+a.source+"|"+c.source+")*"),p=new RegExp("(?:"+f.source+"|"+o.source+")"),h=new RegExp("\\("+p.source+"\\.\\."+p.source+"\\)"),g=new RegExp("\\(("+p.source+")\\.\\.("+p.source+")\\)"),d=new RegExp("(?:"+f.source+"|"+l.source+"|"+h.source+")"),v=new RegExp("(?:"+a.source+")\\s*:\\s*(?:"+d.source+")"),m=new RegExp("("+a.source+")\\s*:\\s*("+d.source+")","g"),y=new RegExp("^\\s*("+a.source+")\\s*([\\s\\S]*)\\s*$"),j=new RegExp("^"+l.source+"$","i"),w=new RegExp("^"+f.source+"$"),x=new RegExp("^"+o.source+"$"),b=new RegExp("^"+u.source+"$","i"),E=new RegExp("^"+n.source+"$"),T=new RegExp("^"+g.source+"$"),S=new RegExp("^"+i.source+"$"),k=new RegExp("(?:"+a.source+"\\s*:\\s*)?"+d.source),R=new RegExp(k.source+"(\\s*,\\s*"+k.source+")*"),O=new RegExp(a.source+"(?:\\s*:\\s*"+R.source+")?","g"),M=new RegExp("("+a.source+")(?:\\s*:\\s*("+R.source+"))?"),_=new RegExp("^"+M.source+"$");t.exports={quoted:n,number:o,bool:u,literal:l,filter:O,integer:i,hash:v,hashCapture:m,range:h,rangeCapture:g,identifier:a,value:d,quoteBalanced:s,operators:[/\s+or\s+/,/\s+and\s+/,/==|!=|<=|>=|<|>|\s+contains\s+/],quotedLine:E,numberLine:x,boolLine:b,rangeLine:T,literalLine:j,filterLine:_,tagLine:y,isLiteral:function(e){return j.test(e)},isVariable:function(e){return w.test(e)},parseLiteral:function(e){var t=e.match(x);if(t)return Number(e);if(t=e.match(b))return"true"===e.toLowerCase();if(t=e.match(E))return e.slice(1,-1);throw new TypeError("cannot parse '"+e+"' as literal")},isRange:function(e){return T.test(e)},matchValue:function(e){return d.exec(e)},isInteger:function(e){return S.test(e)}}},{}],11:[function(e,t,r){"use strict";t.exports=function(e){return{"==":function(e,t){return e===t},"!=":function(e,t){return e!==t},">":function(e,t){return null!==e&&null!==t&&e>t},"<":function(e,t){return null!==e&&null!==t&&e<t},">=":function(e,t){return null!==e&&null!==t&&e>=t},"<=":function(e,t){return null!==e&&null!==t&&e<=t},contains:function(e,t){return!!e&&("function"==typeof e.indexOf&&e.indexOf(t)>-1)},and:function(t,r){return e(t)&&e(r)},or:function(t,r){return e(t)||e(r)}}}},{}],12:[function(e,t,r){"use strict";var n=e("./lexical.js"),s=e("./util/error.js").ParseError,i=e("./util/assert.js");t.exports=function(e,t){var r={init:function(e){return this.tokens=e,this.handlers={},this},on:function(e,t){return this.handlers[e]=t,this},trigger:function(e,t){var r=this.handlers[e];if("function"==typeof r)return r(t),!0},start:function(){var e;for(this.trigger("start");!this.stopRequested&&(e=this.tokens.shift());)if(!(this.trigger("token",e)||"tag"===e.type&&this.trigger("tag:"+e.name,e))){var t=o(e,this.tokens);this.trigger("template",t)}return this.stopRequested||this.trigger("end"),this},stop:function(){return this.stopRequested=!0,this}};function o(e,t){try{var r=null;return(r="tag"===e.type?u(e,t):"value"===e.type?a(e.value):e).token=e,r}catch(t){throw new s(t,e)}}function u(t,r){return"continue"===t.name||"break"===t.name?t:e.construct(t,r)}function a(e){var r=n.matchValue(e);i(r,"illegal value string: "+e);var s=r[0];e=e.substr(r.index+r[0].length);for(var o=[];r=n.filter.exec(e);)o.push([r[0].trim()]);return{type:"value",initial:s,filters:o.map(function(e){return t.construct(e)})}}return{parse:function(e){for(var t,r=[];t=e.shift();)r.push(o(t,e));return r},parseTag:u,parseStream:function(e){return Object.create(r).init(e)},parseValue:a}}},{"./lexical.js":10,"./util/assert.js":18,"./util/error.js":19}],13:[function(e,t,r){"use strict";var n=e("./syntax.js"),s=e("any-promise"),i=e("./util/promise.js").mapSeries,o=e("./util/error.js").RenderBreakError,u=e("./util/error.js").RenderError,a=e("./util/assert.js"),c={renderTemplates:function(e,t){var r=this;a(t,"unable to evalTemplates: scope undefined");var n="";return i(e,function(e){return function(e){var r=this;return"tag"===e.type?this.renderTag(e,t).then(function(e){return void 0===e?"":e}):"value"===e.type?s.resolve().then(function(){return r.evalValue(e,t)}).then(function(e){return void 0===e?"":"string"==typeof(t=e)?t:JSON.stringify(t);var t}):s.resolve(e.value)}.call(r,e).then(function(e){return n+=e}).catch(function(t){if(t instanceof o)throw t.resolvedHTML=n,t;throw new u(t,e)})}).then(function(){return n})},renderTag:function(e,t){return"continue"===e.name?s.reject(new o("continue")):"break"===e.name?s.reject(new o("break")):e.render(t)},evalValue:function(e,t){return a(t,"unable to evalValue: scope undefined"),e.filters.reduce(function(e,r){return r.render(e,t)},n.evalExp(e.initial,t))}};t.exports=function(){return Object.create(c)}},{"./syntax.js":15,"./util/assert.js":18,"./util/error.js":19,"./util/promise.js":21,"any-promise":3}],14:[function(e,t,r){"use strict";var n=e("./util/underscore.js"),s=e("./lexical.js"),i=e("./util/assert.js"),o={getAll:function(){for(var e={},t=this.scopes.length-1;t>=0;t--)n.assign(e,this.scopes[t]);return e},get:function(e){try{return this.getPropertyByPath(this.scopes,e)}catch(e){if(!/undefined variable/.test(e.message)||this.opts.strict_variables)throw e}},set:function(e,t){return function(e,t,r){for(var s=(t+"").replace(/\[/g,".").replace(/\]/g,"").split("."),i=0;i<s.length;i++){var o=s[i];if(!n.isObject(e))return;if(i===s.length-1)return e[o]=r;void 0===e[o]&&(e[o]={}),e=e[o]}}(this.findScopeFor(e),e,t),this},push:function(e){return i(e,"trying to push "+e+" into scopes"),this.scopes.push(e)},pop:function(){return this.scopes.pop()},findScopeFor:function(e){for(var t=this.scopes.length-1;t>=0&&!(e in this.scopes[t]);)t--;return t<0&&(t=this.scopes.length-1),this.scopes[t]},unshift:function(e){return i(e,"trying to push "+e+" into scopes"),this.scopes.unshift(e)},shift:function(){return this.scopes.shift()},getPropertyByPath:function(e,t){var r=this.propertyAccessSeq(t+"");if(!r.length)throw new TypeError("undefined variable: "+t);var s=function(e,t){for(var r=t.length-1;r>-1;r--){var n=t[r];if(n.hasOwnProperty(e))return n[e]}throw new TypeError("undefined variable: "+e)}(r.shift(),e);return r.reduce(function(e,t){if(n.isNil(e))throw new TypeError("undefined variable: "+t);return s=e,"size"===(r=t)&&(n.isArray(s)||n.isString(s))?s.length:s[r];var r,s},s)},propertyAccessSeq:function(e){for(var t,r=[],n="",o=0;o<e.length;)switch(e[o]){case"[":c();var a=e[o+1];/['"]/.test(a)?(t=e.indexOf(a,o+2),i(-1!==t,"unbalanced "+a+": "+e),n=e.slice(o+2,t),c(),o=t+2):(t=u(e,o+1),i(-1!==t,"unbalanced []: "+e),n=e.slice(o+1,t),s.isInteger(n)||(n=this.get(n)),c(),o=t+1);break;case".":c(),o++;break;default:n+=e[o],o++}return c(),r;function c(){n.length&&r.push(n),n=""}}};function u(e,t){for(var r=1,n=t;n<e.length;n++)if("["===e[n]&&r++,"]"===e[n]&&0===--r)return n;return-1}r.factory=function(e,t){var r=Object.create(o);return r.opts=n.assign({dynamicPartials:!0,strict_variables:!1,strict_filters:!1,blocks:{},root:[]},t),r.scopes=[e||{}],r}},{"./lexical.js":10,"./util/assert.js":18,"./util/underscore.js":23}],15:[function(e,t,r){"use strict";var n=e("./operators.js")(u),s=e("./lexical.js"),i=e("../src/util/assert.js");function o(e,t){if(e=e&&e.trim()){if(s.isLiteral(e))return s.parseLiteral(e);if(s.isVariable(e))return t.get(e);throw new TypeError("cannot eval '"+e+"' as value")}}function u(e){return!a(e)}function a(e){return!1===e||void 0===e||null===e}t.exports={evalExp:function e(t,r){i(r,"unable to evalExp: scope undefined");for(var u,a=s.operators,c=0;c<a.length;c++){var l=a[c],f=new RegExp("^("+s.quoteBalanced.source+")("+l.source+")("+s.quoteBalanced.source+")$");if(u=t.match(f)){var p=e(u[1],r);return(0,n[u[2].trim()])(p,e(u[3],r))}}if(u=t.match(s.rangeLine)){for(var h=o(u[1],r),g=o(u[2],r),d=[],v=h;v<=g;v++)d.push(v);return d}return o(t,r)},evalValue:o,isTruthy:u,isFalsy:a}},{"../src/util/assert.js":18,"./lexical.js":10,"./operators.js":11}],16:[function(e,t,r){"use strict";var n=e("./lexical.js"),s=e("any-promise"),i=e("./syntax.js"),o=e("./util/assert.js");t.exports=function(){var e={},t={render:function(e){var t=function(e,t){var r,s={};for(n.hashCapture.lastIndex=0;r=n.hashCapture.exec(e);){var o=r[1],u=r[2];s[o]=i.evalValue(u,t)}return s}(this.token.args,e),r=this.tagImpl;return"function"!=typeof r.render?s.resolve(""):s.resolve().then(function(){return r.render(e,t)})},parse:function(t,r){this.type="tag",this.token=t,this.name=t.name;var n=e[this.name];o(n,"tag "+this.name+" not found"),this.tagImpl=Object.create(n),this.tagImpl.parse&&this.tagImpl.parse(t,r)}};return{construct:function(e,r){var n=Object.create(t);return n.parse(e,r),n},register:function(t,r){e[t]=r},clear:function(){e={}}}}},{"./lexical.js":10,"./syntax.js":15,"./util/assert.js":18,"any-promise":3}],17:[function(e,t,r){"use strict";var n=e("./lexical.js"),s=e("./util/error.js").TokenizationError,i=e("./util/underscore.js"),o=e("./whitespace-ctrl.js"),u=e("./util/assert.js");r.parse=function(e,t,r){u(i.isString(e),"illegal input");for(var a,c,l,f,p,h,g,d=/({%-?([\s\S]*?)-?%})|({{-?([\s\S]*?)-?}})/g,v=0,m=(a=e,c=0,l=-1,{get:function(e){var t=a.slice(l+1,e).split("\n");return c+=t.length-1,l=e,c+1}}),y=0,j=[];f=d.exec(e);y=d.lastIndex)f.index>y&&j.push(x(y,f.index)),j.push(f[1]?w(f[1],f[2].trim(),f.index):(p=f[3],h=f[4].trim(),g=f.index,{type:"value",line:m.get(g),trim_left:"{{-"===p.slice(0,3),trim_right:"-}}"===p.slice(-3),raw:p,value:h,input:e,file:t}));return e.length>y&&j.push(x(y,e.length)),o(j,r),j;function w(r,i,o){var u=i.match(n.tagLine),a={type:"tag",indent:v,line:m.get(o),trim_left:"{%-"===r.slice(0,3),trim_right:"-%}"===r.slice(-3),raw:r,value:i,input:e,file:t};if(!u)throw new s("illegal tag syntax",a);return a.name=u[1],a.args=u[2],a}function x(t,r){var n=e.slice(t,r);return v=i.last(n.split("\n")).length,{type:"html",raw:n,value:n}}},r.whiteSpaceCtrl=o},{"./lexical.js":10,"./util/assert.js":18,"./util/error.js":19,"./util/underscore.js":23,"./whitespace-ctrl.js":25}],18:[function(e,t,r){"use strict";var n=e("./error.js").AssertionError;t.exports=function(e,t){if(!e)throw new n(t=t||"expect "+e+" to be true")}},{"./error.js":19}],19:[function(e,t,r){"use strict";var n=e("./underscore.js");function s(){this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}function i(e,t){s.call(this),this.input=t.input,this.line=t.line,this.file=t.file;var r,i,o,u,a,c=(r=t.input,i=t.line,o=r.split("\n"),u=Math.max(i-2,1),a=Math.min(i+3,o.length),n.range(u,a+1).map(function(e){return[e===i?">> ":" ",(t=e,r=a,n=t+"",Array((r+"").length-n.length).join(" ")+n),"| ",o[e-1]].join("");var t,r,n}).join("\n"));this.message=function(e,t){e=e||"",t.file&&(e+=", file:"+t.file);t.line&&(e+=", line:"+t.line);return e}(e.message,t),this.stack=c+"\n"+(this.stack||this.message)+(e.stack?"\nFrom "+e.stack:"")}function o(e,t){i.call(this,{message:e},t)}function u(e,t){n.assign(this,e),this.originalError=e,i.call(this,e,t)}function a(e,t){if(e instanceof a)return e;n.assign(this,e),this.originalError=e,i.call(this,e,t.token)}function c(e){s.call(this),this.message=e+""}function l(e){s.call(this),this.message=e+""}o.prototype=Object.create(Error.prototype),o.prototype.constructor=o,u.prototype=Object.create(Error.prototype),u.prototype.constructor=u,a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,c.prototype=Object.create(Error.prototype),c.prototype.constructor=c,l.prototype=Object.create(Error.prototype),l.prototype.constructor=l,t.exports={TokenizationError:o,ParseError:u,RenderBreakError:c,AssertionError:l,RenderError:a}},{"./underscore.js":23}],20:[function(e,t,r){"use strict";var n=e("fs");t.exports={readFileAsync:function(e){return new Promise(function(t,r){n.readFile(e,"utf8",function(e,n){e?r(e):t(n)})})},statFileAsync:function(e){return new Promise(function(t,r){n.stat(e,function(e,n){return e?r(e):t(n)})})}}},{fs:6}],21:[function(e,t,r){"use strict";var n=e("any-promise");r.anySeries=function(e,t){var r=n.reject(new Error("init"));return e.forEach(function(n,s){r=r.catch(function(r){return t(n,s,e)})}),r},r.mapSeries=function(e,t){var r=n.resolve("init"),s=[];return e.forEach(function(n,i){r=r.then(function(){return t(n,i,e)}).then(function(e){return s.push(e)})}),r.then(function(){return s})}},{"any-promise":3}],22:[function(e,t,r){"use strict";var n=["January","February","March","April","May","June","July","August","September","October","November","December"],s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],i=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],o=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],u={1:"st",2:"nd",3:"rd",default:"th"},a={daysInMonth:function(e){return[31,a.isLeapYear(e)?29:28,31,30,31,30,31,31,30,31,30,31]},getDayOfYear:function(e){for(var t=0,r=0;r<e.getMonth();++r)t+=a.daysInMonth(e)[r];return t+e.getDate()},getWeekOfYear:function(e,t){var r=this.getDayOfYear(e)+(t-e.getDay()),n=7-new Date(e.getFullYear(),0,1).getDay()+t;return c.pad(Math.floor((r-n)/7)+1,2)},isLeapYear:function(e){var t=e.getFullYear();return!(0!=(3&t)||!(t%100||t%400==0&&t))},getSuffix:function(e){var t=e.getDate().toString(),r=parseInt(t.slice(-1));return u[r]||u.default},century:function(e){return parseInt(e.getFullYear().toString().substring(0,2),10)}},c={pad:function(e,t,r){r||(r="0");for(var n=e.toString(),s=t-n.length;s-- >0;)n=r+n;return n}},l={a:function(e){return o[e.getDay()]},A:function(e){return i[e.getDay()]},b:function(e){return s[e.getMonth()]},B:function(e){return n[e.getMonth()]},c:function(e){return e.toLocaleString()},C:function(e){return a.century(e)},d:function(e){return c.pad(e.getDate(),2)},e:function(e){return c.pad(e.getDate(),2," ")},H:function(e){return c.pad(e.getHours(),2)},I:function(e){return c.pad(e.getHours()%12||12,2)},j:function(e){return c.pad(a.getDayOfYear(e),3)},k:function(e){return c.pad(e.getHours(),2," ")},l:function(e){return c.pad(e.getHours()%12||12,2," ")},L:function(e){return c.pad(e.getMilliseconds(),3)},m:function(e){return c.pad(e.getMonth()+1,2)},M:function(e){return c.pad(e.getMinutes(),2)},p:function(e){return e.getHours()<12?"AM":"PM"},P:function(e){return e.getHours()<12?"am":"pm"},q:function(e){return a.getSuffix(e)},s:function(e){return Math.round(e.valueOf()/1e3)},S:function(e){return c.pad(e.getSeconds(),2)},u:function(e){return e.getDay()||7},U:function(e){return a.getWeekOfYear(e,0)},w:function(e){return e.getDay()},W:function(e){return a.getWeekOfYear(e,1)},x:function(e){return e.toLocaleDateString()},X:function(e){return e.toLocaleTimeString()},y:function(e){return e.getFullYear().toString().substring(2,4)},Y:function(e){return e.getFullYear()},z:function(e){var t=e.getTimezoneOffset()/60*100;return(t>0?"-":"+")+c.pad(Math.abs(t),4)},"%":function(){return"%"}};l.h=l.b,l.N=l.L;t.exports=function(e,t){for(var r="",n=t;;){var s=/%./g,i=s.exec(n);if(!i)return r+n;r+=n.slice(0,s.lastIndex-2),n=n.slice(s.lastIndex);var o=i[0].charAt(1),u=l[o];r+=u?u.call(this,e):"%"+o}}},{}],23:[function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=Object.prototype.toString;function i(e,t){e=e||{};for(var r in e)if(e.hasOwnProperty(r)&&!1===t(e[r],r,e))break;return e}function o(e){var t=void 0===e?"undefined":n(e);return null!=e&&("object"===t||"function"===t)}r.isString=function(e){return e instanceof String||"string"==typeof e},r.isObject=o,r.isArray=function(e){return"[object Array]"===s.call(e)},r.isNil=function(e){return null===e||void 0===e},r.isError=function(e){return"Error"===Object.prototype.toString.call(e).substr(-6,5)||"string"==typeof e.message&&"string"==typeof e.name},r.range=function(e,t,r){1===arguments.length&&(t=e,e=0),r=r||1;for(var n=[],s=e;s<t;s+=r)n.push(s);return n},r.last=function(e){return e[e.length-1]},r.forOwn=i,r.assign=function(e){return e=o(e)?e:{},Array.prototype.slice.call(arguments,1).forEach(function(t){var r;r=e,i(t,function(e,t){r[t]=e})}),e},r.uniq=function(e){for(var t={},r=[],n=0,s=e.length;n<s;++n)t.hasOwnProperty(e[n])||(r.push(e[n]),t[e[n]]=1);return r}},{}],24:[function(e,t,r){"use strict";var n=e("resolve-url"),s=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^/]+?|)(\.[^./]*|))(?:[/]*)$/,i=/^(?:\w+:)?\/\/([^\s.]+\.\S{2}|localhost[:?\d]*)\S*$/;r.extname=function(e){return s.exec(e).slice(1)[3]},r.valid=function(e){return i.test(e)},r.resolve=function(e,t){return"[object Array]"===Object.prototype.toString.call(e)&&(e=e[0]),e&&"/"!==e.charAt(e.length-1)&&(e+="/"),n(e,t)}},{"resolve-url":8}],25:[function(e,t,r){"use strict";var n=e("./util/underscore.js");t.exports=function(e,t){t=n.assign({greedy:!0},t);var r=!1;e.forEach(function(n,s){var i,o,u,a;u=n,a=t,!r&&("tag"===u.type?u.trim_left||a.trim_tag_left:"value"===u.type?u.trim_left||a.trim_value_left:void 0)&&function(e,t){if(e&&"html"===e.type){var r=t?/\s+$/g:/[\t\r ]*$/g;e.value=e.value.replace(r,"")}}(e[s-1],t.greedy),"tag"===n.type&&"raw"===n.name&&(r=!0),"tag"===n.type&&"endraw"===n.name&&(r=!1),i=n,o=t,!r&&("tag"===i.type?i.trim_right||o.trim_tag_right:"value"===i.type?i.trim_right||o.trim_value_right:void 0)&&function(e,t){if(e&&"html"===e.type){var r=t?/^\s+/g:/^[\t\r ]*\n?/g;e.value=e.value.replace(r,"")}}(e[s+1],t.greedy)})}},{"./util/underscore.js":23}],26:[function(e,t,r){"use strict";var n=e("..").lexical,s=e("any-promise"),i=new RegExp("("+n.identifier.source+")\\s*=(.*)"),o=e("../src/util/assert.js");t.exports=function(e){e.registerTag("assign",{parse:function(e){var t=e.args.match(i);o(t,"illegal token "+e.raw),this.key=t[1],this.value=t[2]},render:function(t){return t.set(this.key,e.evalValue(this.value,t)),s.resolve("")}})}},{"..":2,"../src/util/assert.js":18,"any-promise":3}],27:[function(e,t,r){"use strict";var n=e("..").lexical,s=new RegExp("("+n.identifier.source+")"),i=e("../src/util/assert.js");t.exports=function(e){e.registerTag("capture",{parse:function(t,r){var n=this,o=t.args.match(s);i(o,t.args+" not valid identifier"),this.variable=o[1],this.templates=[];var u=e.parser.parseStream(r);u.on("tag:endcapture",function(e){return u.stop()}).on("template",function(e){return n.templates.push(e)}).on("end",function(e){throw new Error("tag "+t.raw+" not closed")}),u.start()},render:function(t,r){var n=this;return e.renderer.renderTemplates(this.templates,t).then(function(e){t.set(n.variable,e)})}})}},{"..":2,"../src/util/assert.js":18}],28:[function(e,t,r){"use strict";var n=e("..");t.exports=function(e){e.registerTag("case",{parse:function(t,r){var n=this;this.cond=t.args,this.cases=[],this.elseTemplates=[];var s=[],i=e.parser.parseStream(r).on("tag:when",function(e){n.cases.push({val:e.args,templates:s=[]})}).on("tag:else",function(){return s=n.elseTemplates}).on("tag:endcase",function(e){return i.stop()}).on("template",function(e){return s.push(e)}).on("end",function(e){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t,r){for(var s=0;s<this.cases.length;s++){var i=this.cases[s];if(n.evalExp(i.val,t)===n.evalExp(this.cond,t))return e.renderer.renderTemplates(i.templates,t)}return e.renderer.renderTemplates(this.elseTemplates,t)}})}},{"..":2}],29:[function(e,t,r){"use strict";t.exports=function(e){e.registerTag("comment",{parse:function(t,r){var n=e.parser.parseStream(r);n.on("token",function(e){"endcomment"===e.name&&n.stop()}).on("end",function(e){throw new Error("tag "+t.raw+" not closed")}),n.start()}})}},{}],30:[function(e,t,r){"use strict";var n=e(".."),s=e("any-promise"),i=n.lexical,o=new RegExp("^(?:("+i.value.source+")\\s*:\\s*)?(.*)$"),u=new RegExp(i.value.source,"g"),a=e("../src/util/assert.js");t.exports=function(e){e.registerTag("cycle",{parse:function(e,t){var r=o.exec(e.args);a(r,"illegal tag: "+e.raw),this.group=r[1]||"";var n=r[2];for(this.candidates=[];r=u.exec(n);)this.candidates.push(r[0]);a(this.candidates.length,"empty candidates: "+e.raw)},render:function(e,t){var r="cycle:"+n.evalValue(this.group,e)+":"+this.candidates.join(","),i=e.opts.groups=e.opts.groups||{},o=i[r];void 0===o&&(o=i[r]=0);var u=this.candidates[o];return o=(o+1)%this.candidates.length,i[r]=o,s.resolve(n.evalValue(u,e))}})}},{"..":2,"../src/util/assert.js":18,"any-promise":3}],31:[function(e,t,r){"use strict";var n=e("..").lexical,s=e("../src/util/assert.js");t.exports=function(e){e.registerTag("decrement",{parse:function(e){var t=e.args.match(n.identifier);s(t,"illegal identifier "+e.args),this.variable=t[0]},render:function(e,t){var r=e.get(this.variable);"number"!=typeof r&&(r=0),e.set(this.variable,r-1)}})}},{"..":2,"../src/util/assert.js":18}],32:[function(e,t,r){"use strict";var n=e(".."),s=n.lexical,i=e("../src/util/promise.js").mapSeries,o=e("../src/util/underscore.js"),u=n.Types.RenderBreakError,a=e("../src/util/assert.js"),c=new RegExp("^("+s.identifier.source+")\\s+in\\s+("+s.value.source+")(?:\\s+"+s.hash.source+")*(?:\\s+(reversed))?(?:\\s+"+s.hash.source+")*$");t.exports=function(e){e.registerTag("for",{parse:function(t,r){var n,s=this,i=c.exec(t.args);a(i,"illegal tag: "+t.raw),this.variable=i[1],this.collection=i[2],this.reversed=!!i[3],this.templates=[],this.elseTemplates=[];var o=e.parser.parseStream(r).on("start",function(){return n=s.templates}).on("tag:else",function(){return n=s.elseTemplates}).on("tag:endfor",function(){return o.stop()}).on("template",function(e){return n.push(e)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});o.start()},render:function(t,r){var s=this,a=n.evalExp(this.collection,t);if(Array.isArray(a)||(o.isString(a)&&a.length>0?a=[a]:o.isObject(a)&&(a=Object.keys(a).map(function(e){return[e,a[e]]}))),!Array.isArray(a)||!a.length)return e.renderer.renderTemplates(this.elseTemplates,t);var c=a.length,l=r.offset||0,f=void 0===r.limit?a.length:r.limit;a=a.slice(l,l+f),this.reversed&&a.reverse();var p=a.map(function(e,t){var r={};return r[s.variable]=e,r.forloop={first:0===t,index:t+1,index0:t,last:t===c-1,length:c,rindex:c-t,rindex0:c-t-1},r}),h="";return i(p,function(r){return Promise.resolve().then(function(){return t.push(r)}).then(function(){return e.renderer.renderTemplates(s.templates,t)}).then(function(e){return h+=e}).catch(function(e){if(!(e instanceof u&&(h+=e.resolvedHTML,"continue"===e.message)))throw e}).then(function(){return t.pop()})}).catch(function(e){if(!(e instanceof u&&"break"===e.message))throw e}).then(function(){return h})}})}},{"..":2,"../src/util/assert.js":18,"../src/util/promise.js":21,"../src/util/underscore.js":23}],33:[function(e,t,r){"use strict";var n=e("..");t.exports=function(e){e.registerTag("if",{parse:function(t,r){var n,s=this;this.branches=[],this.elseTemplates=[];var i=e.parser.parseStream(r).on("start",function(){return s.branches.push({cond:t.args,templates:n=[]})}).on("tag:elsif",function(e){s.branches.push({cond:e.args,templates:n=[]})}).on("tag:else",function(){return n=s.elseTemplates}).on("tag:endif",function(e){return i.stop()}).on("template",function(e){return n.push(e)}).on("end",function(e){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t,r){for(var s=0;s<this.branches.length;s++){var i=this.branches[s],o=n.evalExp(i.cond,t);if(n.isTruthy(o))return e.renderer.renderTemplates(i.templates,t)}return e.renderer.renderTemplates(this.elseTemplates,t)}})}},{"..":2}],34:[function(e,t,r){"use strict";var n=e(".."),s=n.lexical,i=new RegExp("with\\s+("+s.value.source+")"),o=/[^\s,]+/,u=e("../src/util/assert.js");t.exports=function(e){e.registerTag("include",{parse:function(e){var t=o.exec(e.args);t&&(this.staticValue=t[0]),(t=s.value.exec(e.args))&&(this.value=t[0]),(t=i.exec(e.args))&&(this.with=t[1])},render:function(t,r){var s=t.opts.dynamicPartials?n.evalValue(this.value,t):this.staticValue;u(s,"cannot include with empty filename");var i=t.opts.blocks,o=t.opts.blockMode;return t.opts.blocks={},t.opts.blockMode="output",this.with&&(r[s]=n.evalValue(this.with,t)),e.getTemplate(s,t.opts.root).then(function(n){return t.push(r),e.renderer.renderTemplates(n,t)}).then(function(e){return t.pop(),t.opts.blocks=i,t.opts.blockMode=o,e})}})}},{"..":2,"../src/util/assert.js":18}],35:[function(e,t,r){"use strict";var n=e(".."),s=e("../src/util/assert.js"),i=n.lexical;t.exports=function(e){e.registerTag("increment",{parse:function(e){var t=e.args.match(i.identifier);s(t,"illegal identifier "+e.args),this.variable=t[0]},render:function(e,t){var r=e.get(this.variable);"number"!=typeof r&&(r=0),e.set(this.variable,r+1)}})}},{"..":2,"../src/util/assert.js":18}],36:[function(e,t,r){"use strict";t.exports=function(t){e("./assign.js")(t),e("./capture.js")(t),e("./case.js")(t),e("./comment.js")(t),e("./cycle.js")(t),e("./decrement.js")(t),e("./for.js")(t),e("./if.js")(t),e("./include.js")(t),e("./increment.js")(t),e("./layout.js")(t),e("./raw.js")(t),e("./tablerow.js")(t),e("./unless.js")(t)}},{"./assign.js":26,"./capture.js":27,"./case.js":28,"./comment.js":29,"./cycle.js":30,"./decrement.js":31,"./for.js":32,"./if.js":33,"./include.js":34,"./increment.js":35,"./layout.js":37,"./raw.js":38,"./tablerow.js":39,"./unless.js":40}],37:[function(e,t,r){"use strict";var n=e(".."),s=e("any-promise"),i=n.lexical,o=e("../src/util/assert.js"),u=/\S+/;t.exports=function(e){e.registerTag("layout",{parse:function(t,r){var n=u.exec(t.args);n&&(this.staticLayout=n[0]),(n=i.value.exec(t.args))&&(this.layout=n[0]),this.tpls=e.parser.parse(r)},render:function(t,r){var s=t.opts.dynamicPartials?n.evalValue(this.layout,t):this.staticLayout;return o(s,"cannot apply layout with empty filename"),t.opts.blockMode="store",e.renderer.renderTemplates(this.tpls,t).then(function(r){return void 0===t.opts.blocks[""]&&(t.opts.blocks[""]=r),e.getTemplate(s,t.opts.root)}).then(function(n){return t.push(r),t.opts.blockMode="output",e.renderer.renderTemplates(n,t)}).then(function(e){return t.pop(),e})}}),e.registerTag("block",{parse:function(t,r){var n=this,s=/\w+/.exec(t.args);this.block=s?s[0]:"",this.tpls=[];var i=e.parser.parseStream(r).on("tag:endblock",function(){return i.stop()}).on("template",function(e){return n.tpls.push(e)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t){var r=this;return s.resolve(t.opts.blocks[this.block]).then(function(n){return void 0===n?e.renderer.renderTemplates(r.tpls,t):n}).then(function(e){return"store"===t.opts.blockMode?(t.opts.blocks[r.block]=e,""):e})}})}},{"..":2,"../src/util/assert.js":18,"any-promise":3}],38:[function(e,t,r){"use strict";var n=e("any-promise");t.exports=function(e){e.registerTag("raw",{parse:function(t,r){var n=this;this.tokens=[];var s=e.parser.parseStream(r);s.on("token",function(e){"endraw"===e.name?s.stop():n.tokens.push(e)}).on("end",function(e){throw new Error("tag "+t.raw+" not closed")}),s.start()},render:function(e,t){var r=this.tokens.map(function(e){return e.raw}).join("");return n.resolve(r)}})}},{"any-promise":3}],39:[function(e,t,r){"use strict";var n=e(".."),s=e("../src/util/promise.js").mapSeries,i=n.lexical,o=e("../src/util/assert.js"),u=new RegExp("^("+i.identifier.source+")\\s+in\\s+("+i.value.source+")(?:\\s+"+i.hash.source+")*$");t.exports=function(e){e.registerTag("tablerow",{parse:function(t,r){var n,s=this,i=u.exec(t.args);o(i,"illegal tag: "+t.raw),this.variable=i[1],this.collection=i[2],this.templates=[];var a=e.parser.parseStream(r).on("start",function(){return n=s.templates}).on("tag:endtablerow",function(e){return a.stop()}).on("template",function(e){return n.push(e)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});a.start()},render:function(t,r){var i,o,u=this,a=n.evalExp(this.collection,t)||[],c="<table>",l=r.offset||0,f=void 0===r.limit?a.length:r.limit,p=r.cols;if(!p)throw new Error("illegal cols: "+p);var h=[];return(a=a.slice(l,l+f)).some(function(e,t){var r={};r[u.variable]=e,h.push(r)}),s(h,function(r,n){return i=Math.floor(n/p)+1,1===(o=n%p+1)&&(1!==i&&(c+="</tr>"),c+='<tr class="row'+i+'">'),c+='<td class="col'+o+'">',t.push(r),e.renderer.renderTemplates(u.templates,t).then(function(e){return t.pop(r),c+=e,c+="</td>"})}).then(function(){return i>0&&(c+="</tr>"),c+="</table>"})}})}},{"..":2,"../src/util/assert.js":18,"../src/util/promise.js":21}],40:[function(e,t,r){"use strict";var n=e("..");t.exports=function(e){e.registerTag("unless",{parse:function(t,r){var n,s=this;this.templates=[],this.elseTemplates=[];var i=e.parser.parseStream(r).on("start",function(e){n=s.templates,s.cond=t.args}).on("tag:else",function(){return n=s.elseTemplates}).on("tag:endunless",function(e){return i.stop()}).on("template",function(e){return n.push(e)}).on("end",function(e){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t,r){var s=n.evalExp(this.cond,t);return n.isFalsy(s)?e.renderer.renderTemplates(this.templates,t):e.renderer.renderTemplates(this.elseTemplates,t)}})}},{"..":2}]},{},[2])(2)});
{
"name": "liquidjs",
"version": "3.1.1",
"version": "3.1.2",
"description": "Liquid template engine by pure JavaScript: compatible to shopify, easy to extend.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -39,3 +39,5 @@ const lexical = require('./lexical.js')

var re = new RegExp(`${v}\\s*:`, 'g')
re.test(match.input) ? args.push(`'${v}'`) : args.push(v)
var keyMatch = re.exec(match.input)
var currentMatchIsKey = keyMatch && keyMatch.index === match.index
currentMatchIsKey ? args.push(`'${v}'`) : args.push(v)
}

@@ -42,0 +44,0 @@

const Liquid = require('..')
const lexical = Liquid.lexical
const withRE = new RegExp(`with\\s+(${lexical.value.source})`)
const staticFileRE = /\S+/
const staticFileRE = /[^\s,]+/
const assert = require('../src/util/assert.js')

@@ -6,0 +6,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc