shopify-liquid
Advanced tools
Comparing version 1.2.3 to 1.2.4
@@ -1,2 +0,2 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,r.Liquid=e()}}(function(){return function e(r,t,n){function i(o,a){if(!t[o]){if(!r[o]){var u="function"==typeof require&&require;if(!a&&u)return u(o,!0);if(s)return s(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=t[o]={exports:{}};r[o][0].call(l.exports,function(e){var t=r[o][1][e];return i(t?t:e)},l,l.exports,e,r,t,n)}return t[o].exports}for(var s="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(e,r){"use strict";function t(e){var r=(e+"").split(".");return r.length>1?r[1].length:0}function n(e,r){return Math.max(t(e),t(r))}function i(e){return function(r,t){var i=n(r,t);return e(r,t).toFixed(i)}}var s=e("./src/strftime.js");r.exports=function(e){function r(e){return(e||"").replace(/&|<|>|"|'/g,function(e){return n[e]})}function t(e){return(e||"").replace(/&(amp|lt|gt|#34|#39);/g,function(e){return o[e]})}e.registerFilter("abs",function(e){return Math.abs(e)}),e.registerFilter("append",function(e,r){return e+r}),e.registerFilter("capitalize",function(e){return(e||"").charAt(0).toUpperCase()+e.slice(1)}),e.registerFilter("ceil",function(e){return Math.ceil(e)}),e.registerFilter("date",function(e,r){return s(e,r)}),e.registerFilter("default",function(e,r){return r||e}),e.registerFilter("divided_by",function(e,r){return Math.floor(e/r)}),e.registerFilter("downcase",function(e){return e.toLowerCase()});var n={"&":"&","<":"<",">":">",'"':""","'":"'"};e.registerFilter("escape",r);var o={"&":"&","<":"<",">":">",""":'"',"'":"'"};e.registerFilter("escape_once",function(e){return r(t(e))}),e.registerFilter("first",function(e){return e[0]}),e.registerFilter("floor",function(e){return Math.floor(e)}),e.registerFilter("join",function(e,r){return e.join(r)}),e.registerFilter("last",function(e){return e[e.length-1]}),e.registerFilter("lstrip",function(e){return(e||"").replace(/^\s+/,"")}),e.registerFilter("map",function(e,r){return e.map(function(e){return e[r]})}),e.registerFilter("minus",i(function(e,r){return e-r})),e.registerFilter("modulo",i(function(e,r){return e%r})),e.registerFilter("newline_to_br",function(e){return e.replace(/\n/g,"<br />")}),e.registerFilter("plus",i(function(e,r){return e+r})),e.registerFilter("prepend",function(e,r){return r+e}),e.registerFilter("remove",function(e,r){return e.split(r).join("")}),e.registerFilter("remove_first",function(e,r){return e.replace(r,"")}),e.registerFilter("replace",function(e,r,t){return(e||"").split(r).join(t)}),e.registerFilter("replace_first",function(e,r,t){return(e||"").replace(r,t)}),e.registerFilter("reverse",function(e){return(e||"").reverse()}),e.registerFilter("round",function(e,r){var t=Math.pow(10,r||0);return Math.round(e*t,r)/t}),e.registerFilter("rstrip",function(e){return(e||"").replace(/\s+$/,"")}),e.registerFilter("size",function(e){return e.length}),e.registerFilter("slice",function(e,r,t){return e.substr(r,void 0===t?1:t)}),e.registerFilter("sort",function(e,r){return(e||"").sort(r)}),e.registerFilter("split",function(e,r){return(e||"").split(r)}),e.registerFilter("strip",function(e){return(e||"").trim()}),e.registerFilter("strip_html",function(e){return(e||"").replace(/<\/?\s*\w+\s*\/?>/g,"")}),e.registerFilter("strip_newlines",function(e){return(e||"").replace(/\n/g,"")}),e.registerFilter("times",function(e,r){return e*r}),e.registerFilter("truncate",function(e,r,t){return e=e||"",t=void 0===t?"...":t,r=r||16,e.length<=r?e:e.substr(0,r-t.length)+t}),e.registerFilter("truncatewords",function(e,r,t){void 0===t&&(t="...");var n=e.split(" "),i=n.slice(0,r).join(" ");return n.length>r&&(i+=t),i}),e.registerFilter("uniq",function(e){var r={};return(e||[]).filter(function(e){return r.hasOwnProperty(e)?!1:(r[e]=!0,!0)})}),e.registerFilter("upcase",function(e){return(e||"").toUpperCase()}),e.registerFilter("url_encode",encodeURIComponent)}},{"./src/strftime.js":14}],2:[function(e,r){"use strict";function t(e){e=e||{},e.root=e.root||"",e.extname=e.extname||".liquid";var r=Object.create(v);return r.init(c(),l(),e),r}function n(e,r){if("/"==r[0])return r;var t=e.split("/").concat(r.split("/")),n=[];return t.forEach(function(e){".."==e?n.pop():e&&"."!=e&&n.push(e)}),"/"+n.join("/")}var i=e("./src/scope"),s=e("./src/tokenizer.js"),o=e("fs"),a=e("./src/render.js"),u=e("./src/lexical.js"),c=e("./src/tag.js"),l=e("./src/filter.js"),f=e("./src/parser"),p=e("./src/expression.js"),h=e("./tags"),g=e("./filters"),d=e("any-promise"),v={init:function(e,r,t){return t.cache&&(this.cache={}),this.options=t,this.tag=e,this.filter=r,this.parser=f(e,r),this.renderer=a(),h(this),g(this),this},parse:function(e){var r=s.parse(e);return this.parser.parse(r)},render:function(e,r,t){t=t||{},t.strict_variables=t.strict_variables||!1,t.strict_filters=t.strict_filters||!1,this.renderer.resetRegisters();var n=i.factory(r,{strict:t.strict_variables});return this.renderer.renderTemplates(e,n,t)},parseAndRender:function(e,r,t){try{var n=this.parse(e);return this.render(n,r,t)}catch(i){return d.reject(i)}},renderFile:function(e,r,t){var n=this;return this.handleCache(e).then(function(e){return n.render(e,r,t)})["catch"](function(r){throw r.file=e,r})},evalOutput:function(e,r){var t=this.parser.parseOutput(e.trim());return this.renderer.evalOutput(t,r)},registerFilter:function(e,r){return this.filter.register(e,r)},registerTag:function(e,r){return this.tag.register(e,r)},handleCache:function(e){var r=this;if(!e)throw new Error("filepath cannot be null");return this.getTemplate(e).then(function(t){var n=r.options.cache&&r.cache[e]||r.parse(t);return r.options.cache?r.cache[e]=n:n})},getTemplate:function(e){return e=n(this.options.root,e),e.match(/\.\w+$/)||(e+=this.options.extname),new d(function(r,t){o.readFile(e,"utf8",function(e,n){e?t(e):r(n)})})},express:function(e){var r=this;return function(t,n,i){r.renderFile(t,n,e).then(function(e){return i(null,e)})["catch"](function(e){return i(e)})}}};t.lexical=u,t.isTruthy=p.isTruthy,t.isFalsy=p.isFalsy,t.evalExp=p.evalExp,t.evalValue=p.evalValue,r.exports=t},{"./filters":1,"./src/expression.js":8,"./src/filter.js":9,"./src/lexical.js":10,"./src/parser":11,"./src/render.js":12,"./src/scope":13,"./src/tag.js":16,"./src/tokenizer.js":17,"./tags":28,"any-promise":3,fs:6}],3:[function(e,r){"use strict";r.exports=e("./register")().Promise},{"./register":5}],4:[function(e,r){"use strict";var t="@@any-promise/REGISTRATION",n=null;r.exports=function(e,r){return function(i,s){i=i||null,s=s||{};var o=s.global!==!1;if(null===n&&o&&(n=e[t]||null),null!==n&&null!==i&&n.implementation!==i)throw new Error('any-promise already defined as "'+n.implementation+'". You can only register an implementation before the first call to require("any-promise") and an implementation cannot be changed');return null===n&&(n=null!==i&&"undefined"!=typeof s.Promise?{Promise:s.Promise,implementation:i}:r(i),o&&(e[t]=n)),n}}},{}],5:[function(e,r){"use strict";function t(){if("undefined"==typeof 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"}}r.exports=e("./loader")(window,t)},{"./loader":4}],6:[function(){"use strict"},{}],7:[function(e,r){"use strict";function t(e,r,t){Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=e||"",this.input=r,this.line=t}function n(e,r,t,n){Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.originalError=n,this.message=e||"",this.input=r,this.line=t}t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,r.exports={TokenizationError:t,ParseError:n}},{}],8:[function(e,r){"use strict";function t(e,r){if(!r)throw new Error("unable to evalExp: scope undefined");for(var i,s=a.operators,u=0;u<s.length;u++){var c=s[u],l=new RegExp("^("+a.quoteBalanced.source+")("+c.source+")("+a.quoteBalanced.source+")$");if(i=e.match(l)){var f=t(i[1],r),p=o.operators[i[2].trim()],h=t(i[3],r);return p(f,h)}}if(i=e.match(a.rangeLine)){for(var g=n(i[1],r),d=n(i[2],r),v=[],m=g;d>=m;m++)v.push(m);return v}return n(e,r)}function n(e,r){return e=e&&e.trim(),e?a.isLiteral(e)?a.parseLiteral(e):a.isVariable(e)?r.get(e):void 0:void 0}function i(e){return e instanceof Array?!!e.length:!!e}function s(e){return!i(e)}var o=e("./syntax.js"),a=e("./lexical.js");r.exports={evalExp:t,evalValue:n,isTruthy:i,isFalsy:s}},{"./lexical.js":10,"./syntax.js":15}],9:[function(e,r){"use strict";var t=e("./lexical.js"),n=e("./expression.js"),i=new RegExp(""+t.value.source,"g");r.exports=function(){function e(e){var r=Object.create(a);return r.parse(e)}function r(e,r){o[e]=r}function s(){o={}}var o={},a={render:function(e,r){var t=this.args.map(function(e){return n.evalValue(e,r)});return t.unshift(e),this.filter.apply(null,t)},parse:function(e){var r=t.filterLine.exec(e);if(!r)throw new Error("illegal filter: "+e);var n=r[1],s=r[2]||"",a=o[n];if("function"!=typeof a)return{name:n,error:new Error("undefined filter: "+n)};for(var u=[];r=i.exec(s.trim());)u.push(r[0]);return this.name=n,this.filter=a,this.args=u,this}};return{construct:e,register:r,clear:s}}},{"./expression.js":8,"./lexical.js":10}],10:[function(e,r){"use strict";function t(e){return E.test(e)}function n(e){return R.test(e)}function i(e){return T.test(e)}function s(e){var r;return(r=e.match(F))?Number(e):(r=e.match(O))?"true"===e.toLowerCase():(r=e.match(k))?e.slice(1,-1):void 0}var o=/'[^']*'/,a=/"[^"]*"/,u=new RegExp("(?:"+o.source+"|"+a.source+"|[^'\"])*"),c=/(?:-?\d+\.?\d*|\.?\d+)/,l=/true|false/,f=/[a-zA-Z_$][a-zA-Z_$0-9]*/,p=/\[\d+\]/,h=new RegExp("(?:"+o.source+"|"+a.source+")"),g=new RegExp("(?:"+h.source+"|"+l.source+"|"+c.source+")"),d=new RegExp(f.source+"(?:\\."+f.source+"|"+p.source+")*"),v=new RegExp("(?:"+d.source+"|"+c.source+")"),m=new RegExp("\\("+v.source+"\\.\\."+v.source+"\\)"),w=new RegExp("\\(("+v.source+")\\.\\.("+v.source+")\\)"),x=new RegExp("(?:"+g.source+"|"+d.source+"|"+m.source+")"),y=new RegExp("(?:"+f.source+")\\s*:\\s*(?:"+x.source+")"),b=new RegExp("("+f.source+")\\s*:\\s*("+x.source+")","g"),j=new RegExp("^\\s*("+f.source+")\\s*(.*)\\s*$"),E=new RegExp("^"+g.source+"$","i"),T=new RegExp("^"+d.source+"$"),F=new RegExp("^"+c.source+"$"),O=new RegExp("^"+l.source+"$","i"),k=new RegExp("^"+h.source+"$"),R=new RegExp("^"+w.source+"$"),M=new RegExp(x.source+"(\\s*,\\s*"+x.source+")*"),S=new RegExp(f.source+"(?:\\s*:\\s*"+M.source+")?","g"),I=new RegExp("("+f.source+")(?:\\s*:\\s*("+M.source+"))?"),L=new RegExp("^"+I.source+"$"),_=[/\s+or\s+/,/\s+and\s+/,/==|!=|<=|>=|<|>|\s+contains\s+/];r.exports={quoted:h,number:c,bool:l,literal:g,filter:S,hash:y,hashCapture:b,range:m,rangeCapture:w,identifier:f,value:x,quoteBalanced:u,operators:_,quotedLine:k,numberLine:F,boolLine:O,rangeLine:R,literalLine:E,filterLine:L,tagLine:j,isLiteral:t,isVariable:i,parseLiteral:s,isRange:n}},{}],11:[function(e,r){"use strict";var t=e("./lexical.js"),n=e("./error.js").ParseError;r.exports=function(e,r){function i(e){for(var r,t=[];r=e.shift();)t.push(s(r,e));return t}function s(e,r){try{switch(e.type){case"tag":return o(e,r);case"output":return a(e.value);case"html":return e}}catch(t){throw new n(t.message,e.input,e.line,t)}}function o(r,t){return"continue"===r.name||"break"===r.name?r:e.construct(r,t)}function a(e){var n=t.value.exec(e);if(!n)throw new Error("illegal output string: "+e);var i=n[0];e=e.substr(n.index+n[0].length);for(var s=[];n=t.filter.exec(e);)s.push([n[0].trim()]);return{type:"output",initial:i,filters:s.map(function(e){return r.construct(e)})}}function u(e){var r=Object.create(c);return r.init(e)}var c={init:function(e){return this.tokens=e,this.handlers={},this},on:function(e,r){return this.handlers[e]=r,this},trigger:function(e,r){var t=this.handlers[e];return"function"==typeof t?(t(r),!0):void 0},start:function(){this.trigger("start");for(var e;!this.stopRequested&&(e=this.tokens.shift());)if(!(this.trigger("token",e)||"tag"==e.type&&this.trigger("tag:"+e.name,e))){var r=s(e,this.tokens);this.trigger("template",r)}return this.stopRequested||this.trigger("end"),this},stop:function(){return this.stopRequested=!0,this}};return{parse:i,parseTag:o,parseStream:u,parseOutput:a}}},{"./error.js":7,"./lexical.js":10}],12:[function(e,r){"use strict";function t(){var e=Object.create(o);return e.register={},e}function n(e){return"string"==typeof e?e:JSON.stringify(e)}var i=e("./expression.js"),s=e("any-promise"),o={renderTemplates:function(e,r,t){var i=this;if(!r)throw new Error("unable to evalTemplates: scope undefined");t=t||{},t.strict_filters=t.strict_filters||!1;var o="",a=e.reduce(function(e,a){return e.then(function(){if(r.safeGet("forloop.skip"))return s.resolve("");if(r.safeGet("forloop.stop"))throw new Error("forloop.stop");var e=s.resolve("");switch(a.type){case"tag":e=i.renderTag(a,r,i.register).then(function(e){return void 0===e?!0:o+=e});break;case"html":e=s.resolve(a.value).then(function(e){return o+=e});break;case"output":var u=i.evalOutput(a,r,t);e=s.resolve(void 0===u?"":n(u)).then(function(e){return o+=e})}return e})["catch"](function(e){if("forloop.skip"===e.message)return o;throw e})},s.resolve(""));return a.then(function(e){return e})["catch"](function(e){throw e})},renderTag:function(e,r,t){return"continue"===e.name?(r.set("forloop.skip",!0),s.resolve("")):"break"===e.name?(r.set("forloop.stop",!0),r.set("forloop.skip",!0),s.reject(new Error("forloop.stop"))):e.render(r,t)},evalOutput:function(e,r,t){if(!r)throw new Error("unable to evalOutput: scope undefined");var n=i.evalExp(e.initial,r);return e.filters.some(function(e){if(e.error){if(t.strict_filters)throw e.error;return n="",!0}n=e.render(n,r)}),n},resetRegisters:function(){return this.register={}}};r.exports=t},{"./expression.js":8,"any-promise":3}],13:[function(e,r,t){"use strict";function n(e,r,t){if(r instanceof String||"string"==typeof r){for(var n=r.replace(/\[/g,".").replace(/\]/g,"").split("."),i=0;i<n.length;i++){var s=n[i];if(i===n.length-1)return e[s]=t;void 0===e[s]&&(e[s]={}),e=e[s]||{}}return e}return e[r]=t}function i(e,r){if(r instanceof String||"string"==typeof r){var t=r.replace(/\[/g,".").replace(/\]/g,"").split(".");return t.forEach(function(r){return e=e&&e[r]}),e}return e[r]}var s={safeGet:function(e){var r;if(void 0===e){var t={};for(r=this.scopes.length-1;r>=0;r--){var n=this.scopes[r];for(var s in n)n.hasOwnProperty(s)&&(t[s]=n[s])}return t}for(r=this.scopes.length-1;r>=0;r--){var o=i(this.scopes[r],e);if(void 0!==o)return o}},get:function(e){var r=this.safeGet(e);if(void 0===r&&this.opts.strict)throw new Error("[strict_variables] undefined variable: "+e);return r},set:function(e,r){return n(this.scopes[this.scopes.length-1],e,r),this},push:function(e){if(!e)throw new Error("trying to push "+e+" into scopes");return this.scopes.push(e)},pop:function(){return this.scopes.pop()}};t.factory=function(e,r){r=r||{},r.strict=r.strict||!1;var t=Object.create(s);return t.opts=r,t.scopes=[e||{}],t}},{}],14:[function(e,r){"use strict";var t=["January","February","March","April","May","June","July","August","September","October","November","December"],n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],i=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],s=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],o={1:"st",2:"nd",3:"rd","default":"th"},a={daysInMonth:function(e){var r=a.isLeapYear(e)?29:28;return[31,r,31,30,31,30,31,31,30,31,30,31]},getTimezone:function(e){return e.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3")},getGMTOffset:function(e){return(e.getTimezoneOffset()>0?"-":"+")+c.pad(Math.floor(e.getTimezoneOffset()/60),2)+c.pad(e.getTimezoneOffset()%60,2)},getDayOfYear:function(e){for(var r=0,t=0;t<e.getMonth();++t)r+=a.daysInMonth(e)[t];return r+e.getDate()},getWeekOfYear:function(e,r){var t=this.getDayOfYear(e)+(r-e.getDay()),n=new Date(e.getFullYear(),0,1),i=7-n.getDay()+r;return c.pad(Math.floor((t-i)/7)+1,2)},isLeapYear:function(e){var r=e.getFullYear();return!(0!==(3&r)||!(r%100||r%400===0&&r))},getFirstDayOfMonth:function(e){var r=(e.getDay()-(e.getDate()-1))%7;return 0>r?r+7:r},getLastDayOfMonth:function(e){var r=(e.getDay()+(a.daysInMonth(e)[e.getMonth()]-e.getDate()))%7;return 0>r?r+7:r},getSuffix:function(e){var r=e.getDate().toString(),t=parseInt(r.slice(-1));return o[t]||o["default"]},applyOffset:function(e,r){return e.setTime(e.valueOf()-1e3*r),e},century:function(e){return parseInt(e.getFullYear().toString().substring(0,2),10)}},u={values_of:function(e){var r=[];for(var t in e)e.hasOwnProperty(t)&&r.push(e[t]);return r}},c={pad:function h(e,r,t){t||(t="0");for(var n=e.toString(),h=r-n.length;h-->0;)n=t+n;return n}},l={a:function(e){return s[e.getDay()]},A:function(e){return i[e.getDay()]},b:function(e){return n[e.getMonth()]},B:function(e){return t[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 r=e.getTimezoneOffset()/60*100;return(r>0?"-":"+")+c.pad(r,4)},"%":function(){return"%"}};l.h=l.b,l.N=l.L;var f={a:{r:"(?:"+s.join("|")+")"},A:{r:"(?:"+i.join("|")+")"},b:{r:"("+n.join("|")+")",p:function(e){this.month=$.inArray(e,n)}},B:{r:"("+t.join("|")+")",p:function(e){this.month=$.inArray(e,t)}},C:{r:"(\\d{1,2})",p:function(e){this.century=parseInt(e,10)}},d:{r:"(\\d{1,2})",p:function(e){this.day=parseInt(e,10)}},H:{r:"(\\d{1,2})",p:function(e){this.hour=parseInt(e,10)}},j:{r:"(\\d{1,3})",p:function(e){this.day=parseInt(e,10)}},L:{r:"(\\d{3})",p:function(e){this.milliseconds=parseInt(e,10)}},m:{r:"(\\d{1,2})",p:function(e){this.month=parseInt(e,10)-1}},M:{r:"(\\d{2})",p:function(e){this.minute=parseInt(e,10)}},p:{r:"(AM|PM)",p:function(e){"AM"==e?12==this.hour&&(this.hour=0):this.hour<12&&(this.hour+=12)}},P:{r:"(am|pm)",p:function(e){"am"==e?12==this.hour&&(this.hour=0):this.hour<12&&(this.hour+=12)}},q:{r:"(?:"+u.values_of(o).join("|")+")"},S:{r:"(\\d{2})",p:function(e){this.second=parseInt(e,10)}},y:{r:"(\\d{1,2})",p:function(e){this.year=parseInt(e,10)}},Y:{r:"(\\d{4})",p:function(e){this.century=Math.floor(parseInt(e,10)/100),this.year=parseInt(e,10)%100}},z:{r:"(Z|[+-]\\d{2}:?\\d{2})",p:function(e){if("Z"==e)return void(this.zone=0);var r=3600*parseInt(e[0]+e[1]+e[2],10);r+=":"==e[3]?60*parseInt(e[4]+e[5],10):60*parseInt(e[3]+e[4],10),this.zone=r}}};f.e=f.d,f.h=f.b,f.I=f.H,f.k=f.H,f.l=f.H;var p=function(e,r){for(var t="",n=r;;){var i=/%./g,s=i.exec(n);if(!s)return t+n;t+=n.slice(0,i.lastIndex-2),n=n.slice(i.lastIndex);var o=s[0].charAt(1),a=l[o];t+=a?a.call(this,e):"%"+o}};r.exports=p},{}],15:[function(e,r,t){"use strict";var n={"==":function(e,r){return e==r},"!=":function(e,r){return e!=r},">":function(e,r){return e>r},"<":function(e,r){return r>e},">=":function(e,r){return e>=r},"<=":function(e,r){return r>=e},contains:function(e,r){return e.indexOf(r)>-1},and:function(e,r){return e&&r},or:function(e,r){return e||r}};t.operators=n},{}],16:[function(e,r){"use strict";function t(e,r){var t,i={};for(n.hashCapture.lastIndex=0;t=n.hashCapture.exec(e);){var o=t[1],a=t[2];i[o]=s.evalValue(a,r)}return i}var n=e("./lexical.js"),i=e("any-promise"),s=e("./expression.js");r.exports=function(){function e(e,r){s[e]=r}function r(e,r){var t=Object.create(o);return t.parse(e,r),t}function n(){s={}}var s={},o={render:function(e,r){var n=r[this.name];n||(n=r[this.name]={});var s=t(this.token.args,e);return this.tagImpl.render&&this.tagImpl.render(e,s,n)||i.resolve("")},parse:function(e,r){this.type="tag",this.token=e,this.name=e.name;var t=s[this.name];if(!t)throw new Error("tag "+this.name+" not found");this.tagImpl=Object.create(t),this.tagImpl.parse&&this.tagImpl.parse(e,r)}};return{construct:r,register:e,clear:n}}},{"./expression.js":8,"./lexical.js":10,"any-promise":3}],17:[function(e,r,t){"use strict";function n(e){function r(e,r,i){return{type:e,raw:i[r],value:i[r+1].trim(),line:n(i),input:t(i)}}function t(e){var r=e.input.lastIndexOf("\n",e.index),t=e.input.indexOf("\n",e.index);return-1===t&&(t=e.input.length),e.input.slice(r+1,t)}function n(e){var r=e.input.slice(p+1,e.index).split("\n");return h+=r.length-1,p=e.index,h+1}var o=[];if(!e)return o;for(var a,u,c,l=/({%(.*?)%})|({{(.*?)}})/g,f=0,p=-1,h=0;null!==(a=l.exec(e));){if(a.index>f&&(u=e.slice(f,a.index),o.push({type:"html",raw:u,value:u})),a[1]){c=r("tag",1,a);var g=c.value.match(i.tagLine);if(!g)throw new s("illegal tag: "+c.raw,c.input,c.line);c.name=g[1],c.args=g[2],o.push(c)}else c=r("output",3,a),o.push(c);f=l.lastIndex}return e.length>f&&(u=e.slice(f,e.length),o.push({type:"html",raw:u,value:u})),o}var i=e("./lexical.js"),s=e("./error.js").TokenizationError;t.parse=n},{"./error.js":7,"./lexical.js":10}],18:[function(e,r){"use strict";var t=e(".."),n=t.lexical,i=e("any-promise"),s=new RegExp("("+n.identifier.source+")\\s*=(.*)");r.exports=function(e){e.registerTag("assign",{parse:function(e){var r=e.args.match(s);if(!r)throw new Error("illegal token "+e.raw);this.key=r[1],this.value=r[2]},render:function(r){return r.set(this.key,e.evalOutput(this.value,r)),i.resolve("")}})}},{"..":2,"any-promise":3}],19:[function(e,r){"use strict";var t=e(".."),n=t.lexical,i=new RegExp("("+n.identifier.source+")");r.exports=function(e){e.registerTag("capture",{parse:function(r,t){var n=this,s=r.args.match(i);if(!s)throw new Error(r.args+" not valid identifier");this.variable=s[1],this.templates=[];var o=e.parser.parseStream(t);o.on("tag:endcapture",function(){return o.stop()}).on("template",function(e){return n.templates.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")}),o.start()},render:function(r){var t=this;return e.renderer.renderTemplates(this.templates,r).then(function(e){r.set(t.variable,e)})}})}},{"..":2}],20:[function(e,r){"use strict";var t=e("..");r.exports=function(e){e.registerTag("case",{parse:function(r,t){var n=this;this.cond=r.args,this.cases=[],this.elseTemplates=[];var i=[],s=e.parser.parseStream(t).on("tag:when",function(e){n.cases[e.args]||n.cases.push({val:e.args,templates:i=[]})}).on("tag:else",function(){return i=n.elseTemplates}).on("tag:endcase",function(){return s.stop()}).on("template",function(e){return i.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")});s.start()},render:function(r){for(var n=0;n<this.cases.length;n++){var i=this.cases[n],s=t.evalExp(i.val,r),o=t.evalExp(this.cond,r);if(s===o)return e.renderer.renderTemplates(i.templates,r)}return e.renderer.renderTemplates(this.elseTemplates,r)}})}},{"..":2}],21:[function(e,r){"use strict";r.exports=function(e){e.registerTag("comment",{parse:function(r,t){var n=e.parser.parseStream(t);n.on("token",function(e){"endcomment"===e.name&&n.stop()}).on("end",function(){throw new Error("tag "+r.raw+" not closed")}),n.start()}})}},{}],22:[function(e,r){"use strict";var t=e(".."),n=e("any-promise"),i=t.lexical,s=new RegExp("^(?:("+i.value.source+")\\s*:\\s*)?(.*)$"),o=new RegExp(i.value.source,"g");r.exports=function(e){e.registerTag("cycle",{parse:function(e){var r=s.exec(e.args);if(!r)throw new Error("illegal tag: "+e.raw);this.group=r[1]||"";var t=r[2];for(this.candidates=[];r=o.exec(t);)this.candidates.push(r[0]);if(!this.candidates.length)throw new Error("empty candidates: "+e.raw)},render:function(e,r,i){var s=t.evalValue(this.group,e)+":"+this.candidates.join(","),o=i[s];void 0===o&&(o=i[s]=0);var a=this.candidates[o];return o=(o+1)%this.candidates.length,i[s]=o,n.resolve(t.evalValue(a,e))}})}},{"..":2,"any-promise":3}],23:[function(e,r){"use strict";var t=e(".."),n=t.lexical;r.exports=function(e){e.registerTag("decrement",{parse:function(e){var r=e.args.match(n.identifier);if(!r)throw new Error("illegal identifier "+e.args);this.variable=r[0]},render:function(e){var r=e.get(this.variable);"number"!=typeof r&&(r=0),e.set(this.variable,r-1)}})}},{"..":2}],24:[function(e,r){"use strict";var t=e(".."),n=e("any-promise"),i=t.lexical,s=new RegExp("^("+i.identifier.source+")\\s+in\\s+"+("("+i.value.source+")")+("(?:\\s+"+i.hash.source+")*")+"(?:\\s+(reversed))?$");r.exports=function(e){e.registerTag("for",{parse:function(r,t){var n=this,i=s.exec(r.args);if(!i)throw new Error("illegal tag: "+r.raw);this.variable=i[1],this.collection=i[2],this.reversed=!!i[3],this.templates=[],this.elseTemplates=[];var o,a=e.parser.parseStream(t).on("start",function(){return o=n.templates}).on("tag:else",function(){return o=n.elseTemplates}).on("tag:endfor",function(){return a.stop()}).on("template",function(e){return o.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")});a.start()},render:function(r,i){var s=this,o=t.evalExp(this.collection,r);if(t.isFalsy(o))return e.renderer.renderTemplates(this.elseTemplates,r);var a="",u=o.length,c=i.offset||0,l=void 0===i.limit?o.length:i.limit;o=o.slice(c,c+l),this.reversed&&o.reverse();var f=[];o.some(function(e,r){var t={};t[s.variable]=e,t.forloop={first:0===r,index:r+1,index0:r,last:r===u-1,length:u,rindex:u-r,rindex0:u-r-1,stop:!1,skip:!1},f.push(t)});var p=f.reduce(function(t,n){return t.then(function(e){if(r.get("forloop.stop"))throw new Error("forloop.stop");return a+=e}).then(function(){return r.push(n),e.renderer.renderTemplates(s.templates,r)}).then(function(e){return r.pop(n),e})},n.resolve(""));return p.then(function(e){return a+=e})["catch"](function(e){if("forloop.stop"===e.message)return a;throw e})}})}},{"..":2,"any-promise":3}],25:[function(e,r){"use strict";var t=e("..");r.exports=function(e){e.registerTag("if",{parse:function(r,t){var n=this;this.branches=[],this.elseTemplates=[];var i,s=e.parser.parseStream(t).on("start",function(){return n.branches.push({cond:r.args,templates:i=[]})}).on("tag:elsif",function(e){n.branches[e.args]||n.branches.push({cond:e.args,templates:i=[]})}).on("tag:else",function(){return i=n.elseTemplates}).on("tag:endif",function(){return s.stop()}).on("template",function(e){return i.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")});s.start()},render:function(r){for(var n=0;n<this.branches.length;n++){var i=this.branches[n],s=t.evalExp(i.cond,r);if(t.isTruthy(s))return e.renderer.renderTemplates(i.templates,r)}return e.renderer.renderTemplates(this.elseTemplates,r)}})}},{"..":2}],26:[function(e,r){"use strict";var t=e(".."),n=t.lexical,i=new RegExp("with\\s+("+n.value.source+")");r.exports=function(e){e.registerTag("include",{parse:function(e){var r=n.value.exec(e.args);if(!r)throw new Error("illegal token "+e.raw);this.value=r[0],r=i.exec(e.args),r&&(this["with"]=r[1])},render:function(r,n){var i=t.evalValue(this.value,r);return this["with"]&&(n[i]=t.evalValue(this["with"],r)),e.handleCache(i).then(function(t){return r.push(n),e.renderer.renderTemplates(t,r)}).then(function(e){return r.pop(),e})}})}},{"..":2}],27:[function(e,r){"use strict";var t=e(".."),n=t.lexical;r.exports=function(e){e.registerTag("increment",{parse:function(e){var r=e.args.match(n.identifier);if(!r)throw new Error("illegal identifier "+e.args);this.variable=r[0]},render:function(e){var r=e.get(this.variable);"number"!=typeof r&&(r=0),e.set(this.variable,r+1)}})}},{"..":2}],28:[function(e,r){"use strict";r.exports=function(r){e("./assign.js")(r),e("./capture.js")(r),e("./case.js")(r),e("./comment.js")(r),e("./cycle.js")(r),e("./decrement.js")(r),e("./for.js")(r),e("./if.js")(r),e("./include.js")(r),e("./increment.js")(r),e("./layout.js")(r),e("./raw.js")(r),e("./tablerow.js")(r),e("./unless.js")(r)}},{"./assign.js":18,"./capture.js":19,"./case.js":20,"./comment.js":21,"./cycle.js":22,"./decrement.js":23,"./for.js":24,"./if.js":25,"./include.js":26,"./increment.js":27,"./layout.js":29,"./raw.js":30,"./tablerow.js":31,"./unless.js":32}],29:[function(e,r){"use strict";var t=e(".."),n=e("any-promise"),i=t.lexical;r.exports=function(e){e.registerTag("layout",{parse:function(r,t){var n=i.value.exec(r.args);if(!n)throw new Error("illegal token "+r.raw);this.layout=n[0],this.tpls=e.parser.parse(t)},render:function(r){var n=t.evalValue(this.layout,r),i="";return r.push({}),e.renderer.renderTemplates(this.tpls,r).then(function(r){return i+=r,e.handleCache(n)}).then(function(t){return e.renderer.renderTemplates(t,r)}).then(function(e){return r.pop(),e})["catch"](function(e){throw e.file=n,e})}}),e.registerTag("block",{parse:function(r,t){var n=this,i=/\w+/.exec(r.args);this.block=i?i[0]:"",this.tpls=[];var s=e.parser.parseStream(t).on("tag:endblock",function(){return s.stop()}).on("template",function(e){return n.tpls.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")});s.start()},render:function(r){var t=this,i=r.get("_liquid.blocks."+this.block),s=n.resolve("");return void 0===i?s=e.renderer.renderTemplates(this.tpls,r).then(function(e){return r.set("_liquid.blocks."+t.block,e),e}):(r.set("_liquid.blocks."+this.block,i),s=n.resolve(i)),s}})}},{"..":2,"any-promise":3}],30:[function(e,r){"use strict";var t=e("any-promise");r.exports=function(e){e.registerTag("raw",{parse:function(r,t){var n=this;this.tokens=[];var i=e.parser.parseStream(t);i.on("token",function(e){"endraw"===e.name?i.stop():n.tokens.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")}),i.start()},render:function(){var e=this.tokens.map(function(e){return e.raw}).join("");return t.resolve(e)}})}},{"any-promise":3}],31:[function(e,r){"use strict";var t=e(".."),n=e("any-promise"),i=t.lexical,s=new RegExp("^("+i.identifier.source+")\\s+in\\s+"+("("+i.value.source+")")+("(?:\\s+"+i.hash.source+")*$"));r.exports=function(e){e.registerTag("tablerow",{parse:function(r,t){var n=this,i=s.exec(r.args);if(!i)throw new Error("illegal tag: "+r.raw);this.variable=i[1],this.collection=i[2],this.templates=[];var o,a=e.parser.parseStream(t).on("start",function(){return o=n.templates}).on("tag:endtablerow",function(){return a.stop()}).on("template",function(e){return o.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")});a.start()},render:function(r,i){var s,o,a=this,u=t.evalExp(this.collection,r)||[],c="<table>",l=i.offset||0,f=void 0===i.limit?u.length:i.limit,p=i.cols;if(!p)throw new Error("illegal cols: "+p);u=u.slice(l,l+f);var h=[];u.some(function(e){var r={};r[a.variable]=e,h.push(r)});var g=h.reduce(function(t,n,i){return t.then(function(){return s=Math.floor(i/p)+1,o=i%p+1,1===o&&(1!==s&&(c+="</tr>"),c+='<tr class="row'+s+'">'),c+='<td class="col'+o+'">'}).then(function(){return r.push(n),e.renderer.renderTemplates(a.templates,r)}).then(function(e){return r.pop(n),c+=e,c+="</td>"})},n.resolve(""));return g.then(function(){ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,r.Liquid=e()}}(function(){return function e(r,t,n){function i(o,a){if(!t[o]){if(!r[o]){var u="function"==typeof require&&require;if(!a&&u)return u(o,!0);if(s)return s(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=t[o]={exports:{}};r[o][0].call(l.exports,function(e){var t=r[o][1][e];return i(t?t:e)},l,l.exports,e,r,t,n)}return t[o].exports}for(var s="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(e,r){"use strict";function t(e){var r=(e+"").split(".");return r.length>1?r[1].length:0}function n(e,r){return Math.max(t(e),t(r))}function i(e){return e=e||"",e+""}function s(e){return function(r,t){var i=n(r,t);return e(r,t).toFixed(i)}}var o=e("./src/strftime.js");r.exports=function(e){function r(e){return i(e).replace(/&|<|>|"|'/g,function(e){return n[e]})}function t(e){return i(e).replace(/&(amp|lt|gt|#34|#39);/g,function(e){return a[e]})}e.registerFilter("abs",function(e){return Math.abs(e)}),e.registerFilter("append",function(e,r){return e+r}),e.registerFilter("capitalize",function(e){return i(e).charAt(0).toUpperCase()+e.slice(1)}),e.registerFilter("ceil",function(e){return Math.ceil(e)}),e.registerFilter("date",function(e,r){return o(e,r)}),e.registerFilter("default",function(e,r){return r||e}),e.registerFilter("divided_by",function(e,r){return Math.floor(e/r)}),e.registerFilter("downcase",function(e){return e.toLowerCase()});var n={"&":"&","<":"<",">":">",'"':""","'":"'"};e.registerFilter("escape",r);var a={"&":"&","<":"<",">":">",""":'"',"'":"'"};e.registerFilter("escape_once",function(e){return r(t(e))}),e.registerFilter("first",function(e){return e[0]}),e.registerFilter("floor",function(e){return Math.floor(e)}),e.registerFilter("join",function(e,r){return e.join(r)}),e.registerFilter("last",function(e){return e[e.length-1]}),e.registerFilter("lstrip",function(e){return i(e).replace(/^\s+/,"")}),e.registerFilter("map",function(e,r){return e.map(function(e){return e[r]})}),e.registerFilter("minus",s(function(e,r){return e-r})),e.registerFilter("modulo",s(function(e,r){return e%r})),e.registerFilter("newline_to_br",function(e){return e.replace(/\n/g,"<br />")}),e.registerFilter("plus",s(function(e,r){return e+r})),e.registerFilter("prepend",function(e,r){return r+e}),e.registerFilter("remove",function(e,r){return e.split(r).join("")}),e.registerFilter("remove_first",function(e,r){return e.replace(r,"")}),e.registerFilter("replace",function(e,r,t){return i(e).split(r).join(t)}),e.registerFilter("replace_first",function(e,r,t){return i(e).replace(r,t)}),e.registerFilter("reverse",function(e){return e.reverse()}),e.registerFilter("round",function(e,r){var t=Math.pow(10,r||0);return Math.round(e*t,r)/t}),e.registerFilter("rstrip",function(e){return i(e).replace(/\s+$/,"")}),e.registerFilter("size",function(e){return e.length}),e.registerFilter("slice",function(e,r,t){return e.substr(r,void 0===t?1:t)}),e.registerFilter("sort",function(e,r){return e.sort(r)}),e.registerFilter("split",function(e,r){return i(e).split(r)}),e.registerFilter("strip",function(e){return i(e).trim()}),e.registerFilter("strip_html",function(e){return i(e).replace(/<\/?\s*\w+\s*\/?>/g,"")}),e.registerFilter("strip_newlines",function(e){return i(e).replace(/\n/g,"")}),e.registerFilter("times",function(e,r){return e*r}),e.registerFilter("truncate",function(e,r,t){return e=i(e),t=void 0===t?"...":t,r=r||16,e.length<=r?e:e.substr(0,r-t.length)+t}),e.registerFilter("truncatewords",function(e,r,t){void 0===t&&(t="...");var n=e.split(" "),i=n.slice(0,r).join(" ");return n.length>r&&(i+=t),i}),e.registerFilter("uniq",function(e){var r={};return(e||[]).filter(function(e){return r.hasOwnProperty(e)?!1:(r[e]=!0,!0)})}),e.registerFilter("upcase",function(e){return i(e).toUpperCase()}),e.registerFilter("url_encode",encodeURIComponent)}},{"./src/strftime.js":14}],2:[function(e,r){"use strict";function t(e){e=e||{},e.root=e.root||"",e.extname=e.extname||".liquid";var r=Object.create(v);return r.init(c(),l(),e),r}function n(e,r){if("/"==r[0])return r;var t=e.split("/").concat(r.split("/")),n=[];return t.forEach(function(e){".."==e?n.pop():e&&"."!=e&&n.push(e)}),"/"+n.join("/")}var i=e("./src/scope"),s=e("./src/tokenizer.js"),o=e("fs"),a=e("./src/render.js"),u=e("./src/lexical.js"),c=e("./src/tag.js"),l=e("./src/filter.js"),f=e("./src/parser"),p=e("./src/expression.js"),h=e("./tags"),g=e("./filters"),d=e("any-promise"),v={init:function(e,r,t){return t.cache&&(this.cache={}),this.options=t,this.tag=e,this.filter=r,this.parser=f(e,r),this.renderer=a(),h(this),g(this),this},parse:function(e){var r=s.parse(e);return this.parser.parse(r)},render:function(e,r,t){t=t||{},t.strict_variables=t.strict_variables||!1,t.strict_filters=t.strict_filters||!1,this.renderer.resetRegisters();var n=i.factory(r,{strict:t.strict_variables});return this.renderer.renderTemplates(e,n,t)},parseAndRender:function(e,r,t){try{var n=this.parse(e);return this.render(n,r,t)}catch(i){return d.reject(i)}},renderFile:function(e,r,t){var n=this;return this.handleCache(e).then(function(e){return n.render(e,r,t)})["catch"](function(r){throw r.file=e,r})},evalOutput:function(e,r){var t=this.parser.parseOutput(e.trim());return this.renderer.evalOutput(t,r)},registerFilter:function(e,r){return this.filter.register(e,r)},registerTag:function(e,r){return this.tag.register(e,r)},handleCache:function(e){var r=this;if(!e)throw new Error("filepath cannot be null");return this.getTemplate(e).then(function(t){var n=r.options.cache&&r.cache[e]||r.parse(t);return r.options.cache?r.cache[e]=n:n})},getTemplate:function(e){return e=n(this.options.root,e),e.match(/\.\w+$/)||(e+=this.options.extname),new d(function(r,t){o.readFile(e,"utf8",function(e,n){e?t(e):r(n)})})},express:function(e){var r=this;return function(t,n,i){r.renderFile(t,n,e).then(function(e){return i(null,e)})["catch"](function(e){return i(e)})}}};t.lexical=u,t.isTruthy=p.isTruthy,t.isFalsy=p.isFalsy,t.evalExp=p.evalExp,t.evalValue=p.evalValue,r.exports=t},{"./filters":1,"./src/expression.js":8,"./src/filter.js":9,"./src/lexical.js":10,"./src/parser":11,"./src/render.js":12,"./src/scope":13,"./src/tag.js":16,"./src/tokenizer.js":17,"./tags":28,"any-promise":3,fs:6}],3:[function(e,r){"use strict";r.exports=e("./register")().Promise},{"./register":5}],4:[function(e,r){"use strict";var t="@@any-promise/REGISTRATION",n=null;r.exports=function(e,r){return function(i,s){i=i||null,s=s||{};var o=s.global!==!1;if(null===n&&o&&(n=e[t]||null),null!==n&&null!==i&&n.implementation!==i)throw new Error('any-promise already defined as "'+n.implementation+'". You can only register an implementation before the first call to require("any-promise") and an implementation cannot be changed');return null===n&&(n=null!==i&&"undefined"!=typeof s.Promise?{Promise:s.Promise,implementation:i}:r(i),o&&(e[t]=n)),n}}},{}],5:[function(e,r){"use strict";function t(){if("undefined"==typeof 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"}}r.exports=e("./loader")(window,t)},{"./loader":4}],6:[function(){"use strict"},{}],7:[function(e,r){"use strict";function t(e,r,t){Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=e||"",this.input=r,this.line=t}function n(e,r,t,n){Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.originalError=n,this.message=e||"",this.input=r,this.line=t}t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,r.exports={TokenizationError:t,ParseError:n}},{}],8:[function(e,r){"use strict";function t(e,r){if(!r)throw new Error("unable to evalExp: scope undefined");for(var i,s=a.operators,u=0;u<s.length;u++){var c=s[u],l=new RegExp("^("+a.quoteBalanced.source+")("+c.source+")("+a.quoteBalanced.source+")$");if(i=e.match(l)){var f=t(i[1],r),p=o.operators[i[2].trim()],h=t(i[3],r);return p(f,h)}}if(i=e.match(a.rangeLine)){for(var g=n(i[1],r),d=n(i[2],r),v=[],m=g;d>=m;m++)v.push(m);return v}return n(e,r)}function n(e,r){return e=e&&e.trim(),e?a.isLiteral(e)?a.parseLiteral(e):a.isVariable(e)?r.get(e):void 0:void 0}function i(e){return e instanceof Array?!!e.length:!!e}function s(e){return!i(e)}var o=e("./syntax.js"),a=e("./lexical.js");r.exports={evalExp:t,evalValue:n,isTruthy:i,isFalsy:s}},{"./lexical.js":10,"./syntax.js":15}],9:[function(e,r){"use strict";var t=e("./lexical.js"),n=e("./expression.js"),i=new RegExp(""+t.value.source,"g");r.exports=function(){function e(e){var r=Object.create(a);return r.parse(e)}function r(e,r){o[e]=r}function s(){o={}}var o={},a={render:function(e,r){var t=this.args.map(function(e){return n.evalValue(e,r)});return t.unshift(e),this.filter.apply(null,t)},parse:function(e){var r=t.filterLine.exec(e);if(!r)throw new Error("illegal filter: "+e);var n=r[1],s=r[2]||"",a=o[n];if("function"!=typeof a)return{name:n,error:new Error("undefined filter: "+n)};for(var u=[];r=i.exec(s.trim());)u.push(r[0]);return this.name=n,this.filter=a,this.args=u,this}};return{construct:e,register:r,clear:s}}},{"./expression.js":8,"./lexical.js":10}],10:[function(e,r){"use strict";function t(e){return E.test(e)}function n(e){return R.test(e)}function i(e){return T.test(e)}function s(e){var r;return(r=e.match(F))?Number(e):(r=e.match(O))?"true"===e.toLowerCase():(r=e.match(k))?e.slice(1,-1):void 0}var o=/'[^']*'/,a=/"[^"]*"/,u=new RegExp("(?:"+o.source+"|"+a.source+"|[^'\"])*"),c=/(?:-?\d+\.?\d*|\.?\d+)/,l=/true|false/,f=/[a-zA-Z_$][a-zA-Z_$0-9]*/,p=/\[\d+\]/,h=new RegExp("(?:"+o.source+"|"+a.source+")"),g=new RegExp("(?:"+h.source+"|"+l.source+"|"+c.source+")"),d=new RegExp(f.source+"(?:\\."+f.source+"|"+p.source+")*"),v=new RegExp("(?:"+d.source+"|"+c.source+")"),m=new RegExp("\\("+v.source+"\\.\\."+v.source+"\\)"),w=new RegExp("\\(("+v.source+")\\.\\.("+v.source+")\\)"),x=new RegExp("(?:"+g.source+"|"+d.source+"|"+m.source+")"),y=new RegExp("(?:"+f.source+")\\s*:\\s*(?:"+x.source+")"),b=new RegExp("("+f.source+")\\s*:\\s*("+x.source+")","g"),j=new RegExp("^\\s*("+f.source+")\\s*(.*)\\s*$"),E=new RegExp("^"+g.source+"$","i"),T=new RegExp("^"+d.source+"$"),F=new RegExp("^"+c.source+"$"),O=new RegExp("^"+l.source+"$","i"),k=new RegExp("^"+h.source+"$"),R=new RegExp("^"+w.source+"$"),M=new RegExp(x.source+"(\\s*,\\s*"+x.source+")*"),S=new RegExp(f.source+"(?:\\s*:\\s*"+M.source+")?","g"),I=new RegExp("("+f.source+")(?:\\s*:\\s*("+M.source+"))?"),L=new RegExp("^"+I.source+"$"),_=[/\s+or\s+/,/\s+and\s+/,/==|!=|<=|>=|<|>|\s+contains\s+/];r.exports={quoted:h,number:c,bool:l,literal:g,filter:S,hash:y,hashCapture:b,range:m,rangeCapture:w,identifier:f,value:x,quoteBalanced:u,operators:_,quotedLine:k,numberLine:F,boolLine:O,rangeLine:R,literalLine:E,filterLine:L,tagLine:j,isLiteral:t,isVariable:i,parseLiteral:s,isRange:n}},{}],11:[function(e,r){"use strict";var t=e("./lexical.js"),n=e("./error.js").ParseError;r.exports=function(e,r){function i(e){for(var r,t=[];r=e.shift();)t.push(s(r,e));return t}function s(e,r){try{switch(e.type){case"tag":return o(e,r);case"output":return a(e.value);case"html":return e}}catch(t){throw new n(t.message,e.input,e.line,t)}}function o(r,t){return"continue"===r.name||"break"===r.name?r:e.construct(r,t)}function a(e){var n=t.value.exec(e);if(!n)throw new Error("illegal output string: "+e);var i=n[0];e=e.substr(n.index+n[0].length);for(var s=[];n=t.filter.exec(e);)s.push([n[0].trim()]);return{type:"output",initial:i,filters:s.map(function(e){return r.construct(e)})}}function u(e){var r=Object.create(c);return r.init(e)}var c={init:function(e){return this.tokens=e,this.handlers={},this},on:function(e,r){return this.handlers[e]=r,this},trigger:function(e,r){var t=this.handlers[e];return"function"==typeof t?(t(r),!0):void 0},start:function(){this.trigger("start");for(var e;!this.stopRequested&&(e=this.tokens.shift());)if(!(this.trigger("token",e)||"tag"==e.type&&this.trigger("tag:"+e.name,e))){var r=s(e,this.tokens);this.trigger("template",r)}return this.stopRequested||this.trigger("end"),this},stop:function(){return this.stopRequested=!0,this}};return{parse:i,parseTag:o,parseStream:u,parseOutput:a}}},{"./error.js":7,"./lexical.js":10}],12:[function(e,r){"use strict";function t(){var e=Object.create(o);return e.register={},e}function n(e){return"string"==typeof e?e:JSON.stringify(e)}var i=e("./expression.js"),s=e("any-promise"),o={renderTemplates:function(e,r,t){var i=this;if(!r)throw new Error("unable to evalTemplates: scope undefined");t=t||{},t.strict_filters=t.strict_filters||!1;var o="",a=e.reduce(function(e,a){return e.then(function(){if(r.safeGet("forloop.skip"))return s.resolve("");if(r.safeGet("forloop.stop"))throw new Error("forloop.stop");var e=s.resolve("");switch(a.type){case"tag":e=i.renderTag(a,r,i.register).then(function(e){return void 0===e?!0:o+=e});break;case"html":e=s.resolve(a.value).then(function(e){return o+=e});break;case"output":var u=i.evalOutput(a,r,t);e=s.resolve(void 0===u?"":n(u)).then(function(e){return o+=e})}return e})["catch"](function(e){if("forloop.skip"===e.message)return o;throw e})},s.resolve(""));return a.then(function(e){return e})["catch"](function(e){throw e})},renderTag:function(e,r,t){return"continue"===e.name?(r.set("forloop.skip",!0),s.resolve("")):"break"===e.name?(r.set("forloop.stop",!0),r.set("forloop.skip",!0),s.reject(new Error("forloop.stop"))):e.render(r,t)},evalOutput:function(e,r,t){if(!r)throw new Error("unable to evalOutput: scope undefined");var n=i.evalExp(e.initial,r);return e.filters.some(function(e){if(e.error){if(t.strict_filters)throw e.error;return n="",!0}n=e.render(n,r)}),n},resetRegisters:function(){return this.register={}}};r.exports=t},{"./expression.js":8,"any-promise":3}],13:[function(e,r,t){"use strict";function n(e,r,t){if(r instanceof String||"string"==typeof r){for(var n=r.replace(/\[/g,".").replace(/\]/g,"").split("."),i=0;i<n.length;i++){var s=n[i];if(i===n.length-1)return e[s]=t;void 0===e[s]&&(e[s]={}),e=e[s]||{}}return e}return e[r]=t}function i(e,r){if(r instanceof String||"string"==typeof r){var t=r.replace(/\[/g,".").replace(/\]/g,"").split(".");return t.forEach(function(r){return e=e&&e[r]}),e}return e[r]}var s={safeGet:function(e){var r;if(void 0===e){var t={};for(r=this.scopes.length-1;r>=0;r--){var n=this.scopes[r];for(var s in n)n.hasOwnProperty(s)&&(t[s]=n[s])}return t}for(r=this.scopes.length-1;r>=0;r--){var o=i(this.scopes[r],e);if(void 0!==o)return o}},get:function(e){var r=this.safeGet(e);if(void 0===r&&this.opts.strict)throw new Error("[strict_variables] undefined variable: "+e);return r},set:function(e,r){return n(this.scopes[this.scopes.length-1],e,r),this},push:function(e){if(!e)throw new Error("trying to push "+e+" into scopes");return this.scopes.push(e)},pop:function(){return this.scopes.pop()}};t.factory=function(e,r){r=r||{},r.strict=r.strict||!1;var t=Object.create(s);return t.opts=r,t.scopes=[e||{}],t}},{}],14:[function(e,r){"use strict";var t=["January","February","March","April","May","June","July","August","September","October","November","December"],n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],i=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],s=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],o={1:"st",2:"nd",3:"rd","default":"th"},a={daysInMonth:function(e){var r=a.isLeapYear(e)?29:28;return[31,r,31,30,31,30,31,31,30,31,30,31]},getTimezone:function(e){return e.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3")},getGMTOffset:function(e){return(e.getTimezoneOffset()>0?"-":"+")+c.pad(Math.floor(e.getTimezoneOffset()/60),2)+c.pad(e.getTimezoneOffset()%60,2)},getDayOfYear:function(e){for(var r=0,t=0;t<e.getMonth();++t)r+=a.daysInMonth(e)[t];return r+e.getDate()},getWeekOfYear:function(e,r){var t=this.getDayOfYear(e)+(r-e.getDay()),n=new Date(e.getFullYear(),0,1),i=7-n.getDay()+r;return c.pad(Math.floor((t-i)/7)+1,2)},isLeapYear:function(e){var r=e.getFullYear();return!(0!==(3&r)||!(r%100||r%400===0&&r))},getFirstDayOfMonth:function(e){var r=(e.getDay()-(e.getDate()-1))%7;return 0>r?r+7:r},getLastDayOfMonth:function(e){var r=(e.getDay()+(a.daysInMonth(e)[e.getMonth()]-e.getDate()))%7;return 0>r?r+7:r},getSuffix:function(e){var r=e.getDate().toString(),t=parseInt(r.slice(-1));return o[t]||o["default"]},applyOffset:function(e,r){return e.setTime(e.valueOf()-1e3*r),e},century:function(e){return parseInt(e.getFullYear().toString().substring(0,2),10)}},u={values_of:function(e){var r=[];for(var t in e)e.hasOwnProperty(t)&&r.push(e[t]);return r}},c={pad:function h(e,r,t){t||(t="0");for(var n=e.toString(),h=r-n.length;h-->0;)n=t+n;return n}},l={a:function(e){return s[e.getDay()]},A:function(e){return i[e.getDay()]},b:function(e){return n[e.getMonth()]},B:function(e){return t[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 r=e.getTimezoneOffset()/60*100;return(r>0?"-":"+")+c.pad(r,4)},"%":function(){return"%"}};l.h=l.b,l.N=l.L;var f={a:{r:"(?:"+s.join("|")+")"},A:{r:"(?:"+i.join("|")+")"},b:{r:"("+n.join("|")+")",p:function(e){this.month=$.inArray(e,n)}},B:{r:"("+t.join("|")+")",p:function(e){this.month=$.inArray(e,t)}},C:{r:"(\\d{1,2})",p:function(e){this.century=parseInt(e,10)}},d:{r:"(\\d{1,2})",p:function(e){this.day=parseInt(e,10)}},H:{r:"(\\d{1,2})",p:function(e){this.hour=parseInt(e,10)}},j:{r:"(\\d{1,3})",p:function(e){this.day=parseInt(e,10)}},L:{r:"(\\d{3})",p:function(e){this.milliseconds=parseInt(e,10)}},m:{r:"(\\d{1,2})",p:function(e){this.month=parseInt(e,10)-1}},M:{r:"(\\d{2})",p:function(e){this.minute=parseInt(e,10)}},p:{r:"(AM|PM)",p:function(e){"AM"==e?12==this.hour&&(this.hour=0):this.hour<12&&(this.hour+=12)}},P:{r:"(am|pm)",p:function(e){"am"==e?12==this.hour&&(this.hour=0):this.hour<12&&(this.hour+=12)}},q:{r:"(?:"+u.values_of(o).join("|")+")"},S:{r:"(\\d{2})",p:function(e){this.second=parseInt(e,10)}},y:{r:"(\\d{1,2})",p:function(e){this.year=parseInt(e,10)}},Y:{r:"(\\d{4})",p:function(e){this.century=Math.floor(parseInt(e,10)/100),this.year=parseInt(e,10)%100}},z:{r:"(Z|[+-]\\d{2}:?\\d{2})",p:function(e){if("Z"==e)return void(this.zone=0);var r=3600*parseInt(e[0]+e[1]+e[2],10);r+=":"==e[3]?60*parseInt(e[4]+e[5],10):60*parseInt(e[3]+e[4],10),this.zone=r}}};f.e=f.d,f.h=f.b,f.I=f.H,f.k=f.H,f.l=f.H;var p=function(e,r){for(var t="",n=r;;){var i=/%./g,s=i.exec(n);if(!s)return t+n;t+=n.slice(0,i.lastIndex-2),n=n.slice(i.lastIndex);var o=s[0].charAt(1),a=l[o];t+=a?a.call(this,e):"%"+o}};r.exports=p},{}],15:[function(e,r,t){"use strict";var n={"==":function(e,r){return e==r},"!=":function(e,r){return e!=r},">":function(e,r){return e>r},"<":function(e,r){return r>e},">=":function(e,r){return e>=r},"<=":function(e,r){return r>=e},contains:function(e,r){return e.indexOf(r)>-1},and:function(e,r){return e&&r},or:function(e,r){return e||r}};t.operators=n},{}],16:[function(e,r){"use strict";function t(e,r){var t,i={};for(n.hashCapture.lastIndex=0;t=n.hashCapture.exec(e);){var o=t[1],a=t[2];i[o]=s.evalValue(a,r)}return i}var n=e("./lexical.js"),i=e("any-promise"),s=e("./expression.js");r.exports=function(){function e(e,r){s[e]=r}function r(e,r){var t=Object.create(o);return t.parse(e,r),t}function n(){s={}}var s={},o={render:function(e,r){var n=r[this.name];n||(n=r[this.name]={});var s=t(this.token.args,e);return this.tagImpl.render&&this.tagImpl.render(e,s,n)||i.resolve("")},parse:function(e,r){this.type="tag",this.token=e,this.name=e.name;var t=s[this.name];if(!t)throw new Error("tag "+this.name+" not found");this.tagImpl=Object.create(t),this.tagImpl.parse&&this.tagImpl.parse(e,r)}};return{construct:r,register:e,clear:n}}},{"./expression.js":8,"./lexical.js":10,"any-promise":3}],17:[function(e,r,t){"use strict";function n(e){function r(e,r,i){return{type:e,raw:i[r],value:i[r+1].trim(),line:n(i),input:t(i)}}function t(e){var r=e.input.lastIndexOf("\n",e.index),t=e.input.indexOf("\n",e.index);return-1===t&&(t=e.input.length),e.input.slice(r+1,t)}function n(e){var r=e.input.slice(p+1,e.index).split("\n");return h+=r.length-1,p=e.index,h+1}var o=[];if(!e)return o;for(var a,u,c,l=/({%(.*?)%})|({{(.*?)}})/g,f=0,p=-1,h=0;null!==(a=l.exec(e));){if(a.index>f&&(u=e.slice(f,a.index),o.push({type:"html",raw:u,value:u})),a[1]){c=r("tag",1,a);var g=c.value.match(i.tagLine);if(!g)throw new s("illegal tag: "+c.raw,c.input,c.line);c.name=g[1],c.args=g[2],o.push(c)}else c=r("output",3,a),o.push(c);f=l.lastIndex}return e.length>f&&(u=e.slice(f,e.length),o.push({type:"html",raw:u,value:u})),o}var i=e("./lexical.js"),s=e("./error.js").TokenizationError;t.parse=n},{"./error.js":7,"./lexical.js":10}],18:[function(e,r){"use strict";var t=e(".."),n=t.lexical,i=e("any-promise"),s=new RegExp("("+n.identifier.source+")\\s*=(.*)");r.exports=function(e){e.registerTag("assign",{parse:function(e){var r=e.args.match(s);if(!r)throw new Error("illegal token "+e.raw);this.key=r[1],this.value=r[2]},render:function(r){return r.set(this.key,e.evalOutput(this.value,r)),i.resolve("")}})}},{"..":2,"any-promise":3}],19:[function(e,r){"use strict";var t=e(".."),n=t.lexical,i=new RegExp("("+n.identifier.source+")");r.exports=function(e){e.registerTag("capture",{parse:function(r,t){var n=this,s=r.args.match(i);if(!s)throw new Error(r.args+" not valid identifier");this.variable=s[1],this.templates=[];var o=e.parser.parseStream(t);o.on("tag:endcapture",function(){return o.stop()}).on("template",function(e){return n.templates.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")}),o.start()},render:function(r){var t=this;return e.renderer.renderTemplates(this.templates,r).then(function(e){r.set(t.variable,e)})}})}},{"..":2}],20:[function(e,r){"use strict";var t=e("..");r.exports=function(e){e.registerTag("case",{parse:function(r,t){var n=this;this.cond=r.args,this.cases=[],this.elseTemplates=[];var i=[],s=e.parser.parseStream(t).on("tag:when",function(e){n.cases[e.args]||n.cases.push({val:e.args,templates:i=[]})}).on("tag:else",function(){return i=n.elseTemplates}).on("tag:endcase",function(){return s.stop()}).on("template",function(e){return i.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")});s.start()},render:function(r){for(var n=0;n<this.cases.length;n++){var i=this.cases[n],s=t.evalExp(i.val,r),o=t.evalExp(this.cond,r);if(s===o)return e.renderer.renderTemplates(i.templates,r)}return e.renderer.renderTemplates(this.elseTemplates,r)}})}},{"..":2}],21:[function(e,r){"use strict";r.exports=function(e){e.registerTag("comment",{parse:function(r,t){var n=e.parser.parseStream(t);n.on("token",function(e){"endcomment"===e.name&&n.stop()}).on("end",function(){throw new Error("tag "+r.raw+" not closed")}),n.start()}})}},{}],22:[function(e,r){"use strict";var t=e(".."),n=e("any-promise"),i=t.lexical,s=new RegExp("^(?:("+i.value.source+")\\s*:\\s*)?(.*)$"),o=new RegExp(i.value.source,"g");r.exports=function(e){e.registerTag("cycle",{parse:function(e){var r=s.exec(e.args);if(!r)throw new Error("illegal tag: "+e.raw);this.group=r[1]||"";var t=r[2];for(this.candidates=[];r=o.exec(t);)this.candidates.push(r[0]);if(!this.candidates.length)throw new Error("empty candidates: "+e.raw)},render:function(e,r,i){var s=t.evalValue(this.group,e)+":"+this.candidates.join(","),o=i[s];void 0===o&&(o=i[s]=0);var a=this.candidates[o];return o=(o+1)%this.candidates.length,i[s]=o,n.resolve(t.evalValue(a,e))}})}},{"..":2,"any-promise":3}],23:[function(e,r){"use strict";var t=e(".."),n=t.lexical;r.exports=function(e){e.registerTag("decrement",{parse:function(e){var r=e.args.match(n.identifier);if(!r)throw new Error("illegal identifier "+e.args);this.variable=r[0]},render:function(e){var r=e.get(this.variable);"number"!=typeof r&&(r=0),e.set(this.variable,r-1)}})}},{"..":2}],24:[function(e,r){"use strict";var t=e(".."),n=e("any-promise"),i=t.lexical,s=new RegExp("^("+i.identifier.source+")\\s+in\\s+"+("("+i.value.source+")")+("(?:\\s+"+i.hash.source+")*")+"(?:\\s+(reversed))?$");r.exports=function(e){e.registerTag("for",{parse:function(r,t){var n=this,i=s.exec(r.args);if(!i)throw new Error("illegal tag: "+r.raw);this.variable=i[1],this.collection=i[2],this.reversed=!!i[3],this.templates=[],this.elseTemplates=[];var o,a=e.parser.parseStream(t).on("start",function(){return o=n.templates}).on("tag:else",function(){return o=n.elseTemplates}).on("tag:endfor",function(){return a.stop()}).on("template",function(e){return o.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")});a.start()},render:function(r,i){var s=this,o=t.evalExp(this.collection,r);if(t.isFalsy(o))return e.renderer.renderTemplates(this.elseTemplates,r);var a="",u=o.length,c=i.offset||0,l=void 0===i.limit?o.length:i.limit;o=o.slice(c,c+l),this.reversed&&o.reverse();var f=[];o.some(function(e,r){var t={};t[s.variable]=e,t.forloop={first:0===r,index:r+1,index0:r,last:r===u-1,length:u,rindex:u-r,rindex0:u-r-1,stop:!1,skip:!1},f.push(t)});var p=f.reduce(function(t,n){return t.then(function(e){if(r.get("forloop.stop"))throw new Error("forloop.stop");return a+=e}).then(function(){return r.push(n),e.renderer.renderTemplates(s.templates,r)}).then(function(e){return r.pop(n),e})},n.resolve(""));return p.then(function(e){return a+=e})["catch"](function(e){if("forloop.stop"===e.message)return a;throw e})}})}},{"..":2,"any-promise":3}],25:[function(e,r){"use strict";var t=e("..");r.exports=function(e){e.registerTag("if",{parse:function(r,t){var n=this;this.branches=[],this.elseTemplates=[];var i,s=e.parser.parseStream(t).on("start",function(){return n.branches.push({cond:r.args,templates:i=[]})}).on("tag:elsif",function(e){n.branches[e.args]||n.branches.push({cond:e.args,templates:i=[]})}).on("tag:else",function(){return i=n.elseTemplates}).on("tag:endif",function(){return s.stop()}).on("template",function(e){return i.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")});s.start()},render:function(r){for(var n=0;n<this.branches.length;n++){var i=this.branches[n],s=t.evalExp(i.cond,r);if(t.isTruthy(s))return e.renderer.renderTemplates(i.templates,r)}return e.renderer.renderTemplates(this.elseTemplates,r)}})}},{"..":2}],26:[function(e,r){"use strict";var t=e(".."),n=t.lexical,i=new RegExp("with\\s+("+n.value.source+")");r.exports=function(e){e.registerTag("include",{parse:function(e){var r=n.value.exec(e.args);if(!r)throw new Error("illegal token "+e.raw);this.value=r[0],r=i.exec(e.args),r&&(this["with"]=r[1])},render:function(r,n){var i=t.evalValue(this.value,r);return this["with"]&&(n[i]=t.evalValue(this["with"],r)),e.handleCache(i).then(function(t){return r.push(n),e.renderer.renderTemplates(t,r)}).then(function(e){return r.pop(),e})}})}},{"..":2}],27:[function(e,r){"use strict";var t=e(".."),n=t.lexical;r.exports=function(e){e.registerTag("increment",{parse:function(e){var r=e.args.match(n.identifier);if(!r)throw new Error("illegal identifier "+e.args);this.variable=r[0]},render:function(e){var r=e.get(this.variable);"number"!=typeof r&&(r=0),e.set(this.variable,r+1)}})}},{"..":2}],28:[function(e,r){"use strict";r.exports=function(r){e("./assign.js")(r),e("./capture.js")(r),e("./case.js")(r),e("./comment.js")(r),e("./cycle.js")(r),e("./decrement.js")(r),e("./for.js")(r),e("./if.js")(r),e("./include.js")(r),e("./increment.js")(r),e("./layout.js")(r),e("./raw.js")(r),e("./tablerow.js")(r),e("./unless.js")(r)}},{"./assign.js":18,"./capture.js":19,"./case.js":20,"./comment.js":21,"./cycle.js":22,"./decrement.js":23,"./for.js":24,"./if.js":25,"./include.js":26,"./increment.js":27,"./layout.js":29,"./raw.js":30,"./tablerow.js":31,"./unless.js":32}],29:[function(e,r){"use strict";var t=e(".."),n=e("any-promise"),i=t.lexical;r.exports=function(e){e.registerTag("layout",{parse:function(r,t){var n=i.value.exec(r.args);if(!n)throw new Error("illegal token "+r.raw);this.layout=n[0],this.tpls=e.parser.parse(t)},render:function(r){var n=t.evalValue(this.layout,r),i="";return r.push({}),e.renderer.renderTemplates(this.tpls,r).then(function(r){return i+=r,e.handleCache(n)}).then(function(t){return e.renderer.renderTemplates(t,r)}).then(function(e){return r.pop(),e})["catch"](function(e){throw e.file=n,e})}}),e.registerTag("block",{parse:function(r,t){var n=this,i=/\w+/.exec(r.args);this.block=i?i[0]:"",this.tpls=[];var s=e.parser.parseStream(t).on("tag:endblock",function(){return s.stop()}).on("template",function(e){return n.tpls.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")});s.start()},render:function(r){var t=this,i=r.get("_liquid.blocks."+this.block),s=n.resolve("");return void 0===i?s=e.renderer.renderTemplates(this.tpls,r).then(function(e){return r.set("_liquid.blocks."+t.block,e),e}):(r.set("_liquid.blocks."+this.block,i),s=n.resolve(i)),s}})}},{"..":2,"any-promise":3}],30:[function(e,r){"use strict";var t=e("any-promise");r.exports=function(e){e.registerTag("raw",{parse:function(r,t){var n=this;this.tokens=[];var i=e.parser.parseStream(t);i.on("token",function(e){"endraw"===e.name?i.stop():n.tokens.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")}),i.start()},render:function(){var e=this.tokens.map(function(e){return e.raw}).join("");return t.resolve(e)}})}},{"any-promise":3}],31:[function(e,r){"use strict";var t=e(".."),n=e("any-promise"),i=t.lexical,s=new RegExp("^("+i.identifier.source+")\\s+in\\s+"+("("+i.value.source+")")+("(?:\\s+"+i.hash.source+")*$"));r.exports=function(e){e.registerTag("tablerow",{parse:function(r,t){var n=this,i=s.exec(r.args);if(!i)throw new Error("illegal tag: "+r.raw);this.variable=i[1],this.collection=i[2],this.templates=[];var o,a=e.parser.parseStream(t).on("start",function(){return o=n.templates}).on("tag:endtablerow",function(){return a.stop()}).on("template",function(e){return o.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")});a.start()},render:function(r,i){var s,o,a=this,u=t.evalExp(this.collection,r)||[],c="<table>",l=i.offset||0,f=void 0===i.limit?u.length:i.limit,p=i.cols;if(!p)throw new Error("illegal cols: "+p);u=u.slice(l,l+f);var h=[];u.some(function(e){var r={};r[a.variable]=e,h.push(r)});var g=h.reduce(function(t,n,i){return t.then(function(){return s=Math.floor(i/p)+1,o=i%p+1,1===o&&(1!==s&&(c+="</tr>"),c+='<tr class="row'+s+'">'),c+='<td class="col'+o+'">'}).then(function(){return r.push(n),e.renderer.renderTemplates(a.templates,r)}).then(function(e){return r.pop(n),c+=e,c+="</td>"})},n.resolve(""));return g.then(function(){ | ||
return s>0&&(c+="</tr>"),c+="</table>"})["catch"](function(e){throw e})}})}},{"..":2,"any-promise":3}],32:[function(e,r){"use strict";var t=e("..");r.exports=function(e){e.registerTag("unless",{parse:function(r,t){var n=this;this.templates=[],this.elseTemplates=[];var i,s=e.parser.parseStream(t).on("start",function(){i=n.templates,n.cond=r.args}).on("tag:else",function(){return i=n.elseTemplates}).on("tag:endunless",function(){return s.stop()}).on("template",function(e){return i.push(e)}).on("end",function(){throw new Error("tag "+r.raw+" not closed")});s.start()},render:function(r){var n=t.evalExp(this.cond,r);return t.isFalsy(n)?e.renderer.renderTemplates(this.templates,r):e.renderer.renderTemplates(this.elseTemplates,r)}})}},{"..":2}]},{},[2])(2)}); |
@@ -8,3 +8,3 @@ //const strftime = require('strftime').timezone(-(new Date()).getTimezoneOffset()); | ||
liquid.registerFilter('capitalize', str => | ||
(str || '').charAt(0).toUpperCase() + str.slice(1)); | ||
stringify(str).charAt(0).toUpperCase() + str.slice(1)); | ||
liquid.registerFilter('ceil', v => Math.ceil(v)); | ||
@@ -28,3 +28,3 @@ | ||
function escape(str) { | ||
return (str || '').replace(/&|<|>|"|'/g, m => escapeMap[m]); | ||
return stringify(str).replace(/&|<|>|"|'/g, m => escapeMap[m]); | ||
} | ||
@@ -42,3 +42,3 @@ liquid.registerFilter('escape', escape); | ||
function unescape(str) { | ||
return (str || '').replace(/&(amp|lt|gt|#34|#39);/g, m => unescapeMap[m]); | ||
return stringify(str).replace(/&(amp|lt|gt|#34|#39);/g, m => unescapeMap[m]); | ||
} | ||
@@ -50,3 +50,3 @@ liquid.registerFilter('escape_once', str => escape(unescape(str))); | ||
liquid.registerFilter('last', v => v[v.length - 1]); | ||
liquid.registerFilter('lstrip', v => (v || '').replace(/^\s+/, '')); | ||
liquid.registerFilter('lstrip', v => stringify(v).replace(/^\s+/, '')); | ||
liquid.registerFilter('map', (arr, arg) => arr.map(v => v[arg])); | ||
@@ -61,5 +61,5 @@ liquid.registerFilter('minus', bindFixed((v, arg) => v - arg)); | ||
liquid.registerFilter('replace', (v, pattern, replacement) => | ||
(v || '').split(pattern).join(replacement)); | ||
liquid.registerFilter('replace_first', (v, arg1, arg2) => (v || '').replace(arg1, arg2)); | ||
liquid.registerFilter('reverse', v => (v || '').reverse()); | ||
stringify(v).split(pattern).join(replacement)); | ||
liquid.registerFilter('replace_first', (v, arg1, arg2) => stringify(v).replace(arg1, arg2)); | ||
liquid.registerFilter('reverse', v => v.reverse()); | ||
liquid.registerFilter('round', (v, arg) => { | ||
@@ -69,14 +69,14 @@ var amp = Math.pow(10, arg || 0); | ||
}); | ||
liquid.registerFilter('rstrip', str => (str || '').replace(/\s+$/, '')); | ||
liquid.registerFilter('rstrip', str => stringify(str).replace(/\s+$/, '')); | ||
liquid.registerFilter('size', v => v.length); | ||
liquid.registerFilter('slice', (v, begin, length) => | ||
v.substr(begin, length === undefined ? 1 : length)); | ||
liquid.registerFilter('sort', (v, arg) => (v || '').sort(arg)); | ||
liquid.registerFilter('split', (v, arg) => (v || '').split(arg)); | ||
liquid.registerFilter('strip', (v) => (v || '').trim()); | ||
liquid.registerFilter('strip_html', v => (v || '').replace(/<\/?\s*\w+\s*\/?>/g, '')); | ||
liquid.registerFilter('strip_newlines', v => (v || '').replace(/\n/g, '')); | ||
liquid.registerFilter('sort', (v, arg) => v.sort(arg)); | ||
liquid.registerFilter('split', (v, arg) => stringify(v).split(arg)); | ||
liquid.registerFilter('strip', (v) => stringify(v).trim()); | ||
liquid.registerFilter('strip_html', v => stringify(v).replace(/<\/?\s*\w+\s*\/?>/g, '')); | ||
liquid.registerFilter('strip_newlines', v => stringify(v).replace(/\n/g, '')); | ||
liquid.registerFilter('times', (v, arg) => v * arg); | ||
liquid.registerFilter('truncate', (v, l, o) => { | ||
v = v || ''; | ||
v = stringify(v); | ||
o = (o === undefined) ? '...' : o; | ||
@@ -104,3 +104,3 @@ l = l || 16; | ||
}); | ||
liquid.registerFilter('upcase', str => (str || '').toUpperCase()); | ||
liquid.registerFilter('upcase', str => stringify(str).toUpperCase()); | ||
liquid.registerFilter('url_encode', encodeURIComponent); | ||
@@ -118,2 +118,7 @@ }; | ||
function stringify(obj){ | ||
obj = obj || ""; | ||
return obj + ''; | ||
} | ||
function bindFixed(cb) { | ||
@@ -120,0 +125,0 @@ return (l, r) => { |
{ | ||
"name": "shopify-liquid", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"description": "Liquid template engine in Node.js (Shopify compliant)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
321709
3860
0