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 7.2.2 to 7.3.0

dist/src/drop/blank-drop.d.ts

7

CHANGELOG.md

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

# [7.3.0](https://github.com/harttle/liquidjs/compare/v7.2.2...v7.3.0) (2019-02-24)
### Features
* nil/null/empty/blank literals, resolves [#102](https://github.com/harttle/liquidjs/issues/102) ([88c9e96](https://github.com/harttle/liquidjs/commit/88c9e96))
## [7.2.2](https://github.com/harttle/liquidjs/compare/v7.2.1...v7.2.2) (2019-02-23)

@@ -2,0 +9,0 @@

2

dist/liquid.min.js

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Liquid=e()}(this,function(){"use strict";var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function e(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var v=function(){return(v=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function p(o,s,u,a){return new(u||(u=Promise))(function(t,e){function n(t){try{i(a.next(t))}catch(t){e(t)}}function r(t){try{i(a.throw(t))}catch(t){e(t)}}function i(e){e.done?t(e.value):new u(function(t){t(e.value)}).then(n,r)}i((a=a.apply(o,s||[])).next())})}function d(n,r){var i,o,s,t,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=2&e[0]?o.return:e[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,e[1])).done)return s;switch(o=0,s&&(e=[2&e[0],s.value]),e[0]){case 0:case 1:s=e;break;case 4:return u.label++,{value:e[1],done:!1};case 5:u.label++,o=e[1],e=[0];continue;case 7:e=u.ops.pop(),u.trys.pop();continue;default:if(!(s=0<(s=u.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){u=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3])){u.label=e[1];break}if(6===e[0]&&u.label<s[1]){u.label=s[1],s=e;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(e);break}s[2]&&u.ops.pop(),u.trys.pop();continue}e=r.call(n,u)}catch(t){e=[6,t],o=0}finally{i=s=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}var i=Object.prototype.toString,o=Array.prototype.toString;function l(t){return"[object String]"===i.call(t)}function s(t){return"function"==typeof t}function a(t){return u(t)?"":s(t.to_liquid)?a(t.to_liquid()):s(t.toLiquid)?a(t.toLiquid()):s(t.to_s)?t.to_s():-1<[i,o].indexOf(t.toString)?(e=t,n=[],JSON.stringify(e,function(t,e){if(g(e)){if(-1!==n.indexOf(e))return;n.push(e)}return e})):s(t.toString)?t.toString():i.call(t);var e,n}function u(t){return null==t}function f(t){return"[object Array]"===i.call(t)}function c(t,e){for(var n in t=t||{})if(t.hasOwnProperty(n)&&!1===e(t[n],n,t))break;return t}function h(t){return t[t.length-1]}function g(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function m(t,e,n){void 0===e&&(e=t,t=0),n=n||1;for(var r=[],i=t;i<e;i+=n)r.push(i);return r}function w(t,e,n){void 0===n&&(n=" ");for(var r=e-(t=String(t)).length;0<r--;)t=n+t;return t}var t=function(r){function t(t,e){var n=r.call(this,t.message)||this;return n.originalError=t,n.token=e,n}return e(t,r),t.prototype.update=function(){var i,o,t,s,e=this.originalError,n=(i=this.token,o=i.input.split("\n"),t=Math.max(i.line-2,1),s=Math.min(i.line+3,o.length),m(t,s+1).map(function(t){var e=t===i.line?">> ":" ",n=w(String(t),String(s).length),r=o[t-1];return""+e+n+"| "+r}).join("\n"));this.message=function(t,e){e.file&&(t+=", file:"+e.file);return t+=", line:"+e.line+", col:"+e.col}(e.message,this.token),this.stack=this.message+"\n"+n+"\n"+this.stack+"\nFrom "+e.stack},t}(Error),y=function(r){function t(t,e){var n=r.call(this,new Error(t),e)||this;return n.name="TokenizationError",r.prototype.update.call(n),n}return e(t,r),t}(t),n=function(r){function t(t,e){var n=r.call(this,t,e)||this;return n.name="ParseError",n.message=t.message,r.prototype.update.call(n),n}return e(t,r),t}(t),b=function(r){function t(t,e){var n=r.call(this,t,e.token)||this;return n.name="RenderError",n.message=t.message,r.prototype.update.call(n),n}return e(t,r),t}(t),T=function(n){function t(t){var e=n.call(this,t)||this;return e.resolvedHTML="",e.name="RenderBreakError",e.message=t+"",e}return e(t,n),t}(Error),E=function(n){function t(t){var e=n.call(this,t)||this;return e.name="AssertionError",e.message=t+"",e}return e(t,n),t}(Error);function x(t,e){if(!t)throw new E(e=e||"expect "+t+" to be true")}var _,k,S={root:["."],cache:!1,extname:"",dynamicPartials:!0,trim_tag_right:!1,trim_tag_left:!1,trim_output_right:!1,trim_output_left:!1,greedy:!0,tag_delimiter_left:"{%",tag_delimiter_right:"%}",output_delimiter_left:"{{",output_delimiter_right:"}}",strict_filters:!1,strict_variables:!1};function R(t){var e;return(t=t||{}).hasOwnProperty("root")&&(t.root=f(e=t.root)?e:l(e)?[e]:[]),t}function q(t){return v({},S,t)}(k=_||(_={}))[k.OUTPUT=0]="OUTPUT",k[k.STORE=1]="STORE";var M=_,O=function(){function t(t,e){void 0===t&&(t={}),this.blocks={},this.groups={},this.blockMode=M.OUTPUT,this.opts=q(e),this.contexts=[t||{}]}return t.prototype.getAll=function(){return this.contexts.reduce(function(t,e){return v(t,e)},{})},t.prototype.get=function(t){var n=this,e=this.propertyAccessSeq(t),r=this.findContextFor(e[0])||h(this.contexts);return e.reduce(function(t,e){return n.readProperty(t,e)},r)},t.prototype.set=function(t,n){var r=this.propertyAccessSeq(t),i=this.findContextFor(r[0])||h(this.contexts);r.some(function(t,e){return!g(i)||(e===r.length-1?(i[t]=n,!0):(void 0===i[t]&&(i[t]={}),i=i[t],!1))})},t.prototype.unshift=function(t){return this.contexts.unshift(t)},t.prototype.push=function(t){return this.contexts.push(t)},t.prototype.pop=function(e){if(!arguments.length)return this.contexts.pop();var t=this.contexts.findIndex(function(t){return t===e});if(-1===t)throw new TypeError("scope not found, cannot pop");return this.contexts.splice(t,1)[0]},t.prototype.findContextFor=function(t,e){void 0===e&&(e=function(){return!0});for(var n=this.contexts.length-1;0<=n;n--){var r=this.contexts[n];if(e(r)&&t in r)return r}return null},t.prototype.readProperty=function(t,e){var n,r;if(u(t)?n=void 0:(t=function(t){if(s(t.to_liquid))return t.to_liquid();if(s(t.toLiquid))return t.toLiquid();return t}(t),n="size"===e?u((r=t).size)&&(f(r)||l(r))?r.length:r.size:t[e],s(t.liquid_method_missing)&&(n=t.liquid_method_missing(e))),u(n)&&this.opts.strict_variables)throw new TypeError("undefined variable: "+e);return n},t.prototype.propertyAccessSeq=function(t){t=String(t);for(var e,n=[],r="",i=0;i<t.length;)switch(t[i]){case"[":s();var o=t[i+1];i=/['"]/.test(o)?(x(-1!==(e=t.indexOf(o,i+2)),"unbalanced "+o+": "+t),r=t.slice(i+2,e),s(),e+2):(x(-1!==(e=L(t,i+1)),"unbalanced []: "+t),r=t.slice(i+1,e),/^[+-]?\d+$/.test(r)||(r=String(this.get(r))),s(),e+1);break;case".":s(),i++;break;default:r+=t[i],i++}if(s(),!n.length)throw new TypeError('invalid path:"'+t+'"');return n;function s(){r.length&&n.push(r),r=""}},t}();function L(t,e){for(var n=1,r=e;r<t.length;r++)if("["===t[r]&&n++,"]"===t[r]&&0===--n)return r;return-1}var A=function(){},F=function(){},I=function(){},N=function(){},P=Object.freeze({AssignScope:F,CaptureScope:A,IncrementScope:I,DecrementScope:N,ParseError:n,TokenizationError:y,RenderBreakError:T,AssertionError:E});var U={readFile:function(r){return p(this,void 0,void 0,function(){return d(this,function(t){return[2,new Promise(function(t,e){var n=new XMLHttpRequest;n.onload=function(){200<=n.status&&n.status<300?t(n.responseText):e(new Error(n.statusText))},n.onerror=function(){e(new Error("An error occurred whilst receiving the response."))},n.open("GET",r),n.send()})]})})},resolve:function(t,e,i){return t.length&&"/"!==h(t)&&(t+="/"),function(t,e){var n=document.createElement("base");n.href=t;var r=document.getElementsByTagName("head")[0];r.insertBefore(n,r.firstChild);var i=document.createElement("a");i.href=e;var o=i.href;return r.removeChild(n),o}(t,e).replace(/^(\w+:\/\/[^/]+)(\/[^?]+)/,function(t,e,n){var r=n.split("/").pop();return/\.\w+$/.test(r)?t:e+n+i})},exists:function(){return p(this,void 0,void 0,function(){return d(this,function(t){return[2,!0]})})}};var j,D,H=function(t,e,n,r,i){this.type="notset",this.col=r,this.line=n,this.raw=t,this.value=t,this.input=e,this.file=i},z=function(s){function t(t,e,n,r,i){var o=s.call(this,t,e,n,r,i)||this;return o.type="html",o.value=t,o}return e(t,s),t}(H),C=function(u){function t(t,e,n,r,i,o){var s=u.call(this,t,n,r,i,o)||this;return s.trimLeft="-"===e[0],s.trimRight="-"===h(e),s.value=e.slice(s.trimLeft?1:0,s.trimRight?-1:e.length).trim(),s}return e(t,u),t}(H),Y=new RegExp(/'[^']*'/.source+"|"+/"[^"]*"/.source),$=new RegExp("(?:"+Y.source+"|[^'\"])*"),G=/[+-]?(?:\d+\.?\d*|\.?\d+)/,B=/[\w-]+[?]?/,V=new RegExp("\\[(?:"+Y.source+"|[\\w-\\.]+)\\]"),W=new RegExp("(?:"+Y.source+"|"+/true|false/.source+"|"+G.source+")"),J=new RegExp(B.source+"(?:\\."+B.source+"|"+V.source+")*"),X=new RegExp("(?:"+J.source+"|"+G.source+")"),K=new RegExp("\\("+X.source+"\\.\\."+X.source+"\\)"),Q=new RegExp("\\(("+X.source+")\\.\\.("+X.source+")\\)"),Z=new RegExp("(?:"+J.source+"|"+W.source+"|"+K.source+")"),tt=new RegExp("(?:"+B.source+")\\s*:\\s*(?:"+Z.source+")"),et=new RegExp("("+B.source+")\\s*:\\s*("+Z.source+")","g"),nt=new RegExp("^\\s*("+B.source+")\\s*([\\s\\S]*?)\\s*$"),rt=new RegExp("^"+Y.source+"$"),it=new RegExp("^"+Q.source+"$"),ot=[/\s+or\s+/,/\s+and\s+/,/==|!=|<=|>=|<|>|\s+contains\s+/],st=function(a){function t(t,e,n,r,i,o){var s=a.call(this,t,e,n,r,i,o)||this;s.type="tag";var u=s.value.match(nt);if(!u)throw new y("illegal tag syntax",s);return s.name=u[1],s.args=u[2],s}return e(t,a),t}(C),ut=function(u){function t(t,e,n,r,i,o){var s=u.call(this,t,e,n,r,i,o)||this;return s.type="output",s}return e(t,u),t}(C);(D=j||(j={}))[D.HTML=0]="HTML",D[D.OUTPUT=1]="OUTPUT",D[D.TAG=2]="TAG";var at=function(){function t(t){this.options=q(t)}return t.prototype.tokenize=function(t,e){for(var n=[],r=this.options.tag_delimiter_left,i=this.options.tag_delimiter_right,o=this.options.output_delimiter_left,s=this.options.output_delimiter_right,u=0,a=1,c=j.HTML,l="",f=0,h=1,p=1;u<t.length;){if("\n"===t[u]&&(a++,f=u+1),c===j.HTML){if(t.substr(u,o.length)===o){l&&n.push(new z(l,t,h,p,e)),h=a,p=u-f+1,u+=(l=o).length,c=j.OUTPUT;continue}if(t.substr(u,r.length)===r){l&&n.push(new z(l,t,h,p,e)),h=a,p=u-f+1,u+=(l=r).length,c=j.TAG;continue}}else{if(c===j.OUTPUT&&t.substr(u,s.length)===s){l+=s,n.push(new ut(l,l.slice(o.length,-s.length),t,h,p,e)),l="",h=a,p=(u+=s.length)-f+1,c=j.HTML;continue}if(t.substr(u,i.length)===i){l+=i,n.push(new st(l,l.slice(r.length,-i.length),t,h,p,e)),l="",h=a,p=(u+=i.length)-f+1,c=j.HTML;continue}}l+=t[u++]}if(c===j.HTML)return l&&n.push(new z(l,t,h,p,e)),function(s,u){u=v({greedy:!0},u);var a=!1;s.forEach(function(t,e){var n,r,i,o;i=t,o=u,!a&&("tag"===i.type?i.trimLeft||o.trim_tag_left:"output"===i.type?i.trimLeft||o.trim_output_left:void 0)&&function(t,e){if(t&&"html"===t.type){var n=e?/\s+$/g:/[\t\r ]*$/g;t.value=t.value.replace(n,"")}}(s[e-1],u.greedy),"tag"===t.type&&"raw"===t.name&&(a=!0),"tag"===t.type&&"endraw"===t.name&&(a=!1),n=t,r=u,!a&&("tag"===n.type?n.trimRight||r.trim_tag_right:"output"===n.type?n.trimRight||r.trim_output_right:void 0)&&function(t,e){if(t&&"html"===t.type){var n=e?/^\s+/g:/^[\t\r ]*\n?/g;t.value=t.value.replace(n,"")}}(s[e+1],u.greedy)})}(n,this.options),n;var d=c===j.OUTPUT?"output":"tag",g=16<l.length?l.slice(0,13)+"...":l;throw new y(d+' "'+g+'" not closed',new H(l,t,h,p,e))},t}(),ct=function(){function t(){}return t.prototype.renderTemplates=function(u,a){return p(this,void 0,void 0,function(){var e,n,r,i,o,s;return d(this,function(t){switch(t.label){case 0:x(a,"unable to evalTemplates: scope undefined"),e="",n=0,r=u,t.label=1;case 1:if(!(n<r.length))return[3,6];i=r[n],t.label=2;case 2:return t.trys.push([2,4,,5]),o=e,[4,i.render(a)];case 3:return e=o+t.sent(),[3,5];case 4:if("RenderBreakError"===(s=t.sent()).name)throw s.resolvedHTML=e,s;throw"RenderError"===s.name?s:new b(s,i);case 5:return n++,[3,1];case 6:return[2,e]}})})},t}(),lt={"==":function(t,e){return t===e},"!=":function(t,e){return t!==e},">":function(t,e){return null!==t&&null!==e&&e<t},"<":function(t,e){return null!==t&&null!==e&&t<e},">=":function(t,e){return null!==t&&null!==e&&e<=t},"<=":function(t,e){return null!==t&&null!==e&&t<=e},contains:function(t,e){return!!t&&("function"==typeof t.indexOf&&-1<t.indexOf(e))},and:function(t,e){return pt(t)&&pt(e)},or:function(t,e){return pt(t)||pt(e)}};function ft(t,e){x(e,"unable to evalExp: scope undefined");for(var n,r=ot,i=0;i<r.length;i++){var o=r[i],s=new RegExp("^("+$.source+")("+o.source+")("+$.source+")$");if(n=t.match(s)){var u=ft(n[1],e);return(0,lt[n[2].trim()])(u,ft(n[3],e))}}return(n=t.match(it))?m(ht(n[1],e),ht(n[2],e)+1):ht(t,e)}function ht(t,e){return t?"true"===(t=t.trim())||"false"!==t&&(isNaN(Number(t))?'"'!==t[0]&&"'"!==t[0]||t[0]!==h(t)?e.get(t):t.slice(1,-1):Number(t)):null}function pt(t){return!dt(t)}function dt(t){return!1===t||null==t}var gt,vt,mt=function(t,e){var n;for(et.lastIndex=0;n=et.exec(t);){var r=n[1],i=n[2];this[r]=ht(i,e)}},wt=function(t){this.token=t},yt=function(s){function u(t,e,n){var r=s.call(this,t)||this;r.name=t.name;var i,o=u.impls[t.name];return x(o,"tag "+t.name+" not found"),r.impl=(i=o,Object.create(i)),r.impl.liquid=n,r.impl.parse&&r.impl.parse(t,e),r}return e(u,s),u.prototype.render=function(r){return p(this,void 0,void 0,function(){var e,n;return d(this,function(t){switch(t.label){case 0:return e=new mt(this.token.args,r),"function"!=typeof(n=this.impl).render?[2,""]:[4,n.render(r,e)];case 1:return[2,a(t.sent())]}})})},u.register=function(t,e){u.impls[t]=e},u.clear=function(){u.impls={}},u.impls={},u}(wt),bt=function(){function i(t,e,n){var r=i.impls[t];if(!r&&n)throw new TypeError("undefined filter: "+t);this.name=t,this.impl=r||function(t){return t},this.args=e}return i.prototype.render=function(t,e){var n=this.args.map(function(t){return ht(t,e)});return this.impl.apply(null,[t].concat(n))},i.register=function(t,e){i.impls[t]=e},i.clear=function(){i.impls={}},i.impls={},i}(),Tt=function(){function t(t,e){this.handlers={},this.stopRequested=!1,this.tokens=t,this.parseToken=e}return t.prototype.on=function(t,e){return this.handlers[t]=e,this},t.prototype.trigger=function(t,e){var n=this.handlers[t];return"function"==typeof n&&(n(e),!0)},t.prototype.start=function(){var t;for(this.trigger("start");!this.stopRequested&&(t=this.tokens.shift());)if(!(this.trigger("token",t)||"tag"===t.type&&this.trigger("tag:"+t.name,t))){var e=this.parseToken(t,this.tokens);this.trigger("template",e)}return this.stopRequested||this.trigger("end"),this},t.prototype.stop=function(){return this.stopRequested=!0,this},t}();(vt=gt||(gt={}))[vt.INIT=0]="INIT",vt[vt.FILTER_NAME=1]="FILTER_NAME",vt[vt.FILTER_ARG=2]="FILTER_ARG";var Et=function(){function t(t,e){this.filters=[];for(var n="",r="",i=gt.INIT,o=!1,s="",u=[],a=0;a<t.length;a++)if(r)t[a]===r&&(o=!(r="")),n+=t[a];else if(/\s/.test(t[a])){if(!n)continue;o=!0}else if("|"===t[a])i===gt.INIT?this.initial=n:(i===gt.FILTER_NAME?s=n:u.push(n),this.filters.push(new bt(s,u,e)),s="",u=[]),i=gt.FILTER_NAME,n="",o=!1;else if(i===gt.FILTER_NAME&&":"===t[a])s=n,i=gt.FILTER_ARG,n="",o=!1;else if(i===gt.FILTER_ARG&&","===t[a])u.push(n),n="",o=!1;else{if(o)continue;'"'!==t[a]&&"'"!==t[a]||r||(r=t[a]),n+=t[a]}n&&(i===gt.INIT?this.initial=n:i===gt.FILTER_NAME?this.filters.push(new bt(n,[],e)):(u.push(n),this.filters.push(new bt(s,u,e))))}return t.prototype.value=function(n){return this.filters.reduce(function(t,e){return e.render(t,n)},ft(this.initial,n))},t}(),xt=function(r){function t(t,e){var n=r.call(this,t)||this;return n.value=new Et(t.value,e),n}return e(t,r),t.prototype.render=function(e){return p(this,void 0,void 0,function(){return d(this,function(t){switch(t.label){case 0:return[4,this.value.value(e)];case 1:return[2,a(t.sent())]}})})},t}(wt),_t=function(n){function t(t){var e=n.call(this,t)||this;return e.str=t.value,e}return e(t,n),t.prototype.render=function(){return p(this,void 0,void 0,function(){return d(this,function(t){return[2,this.str]})})},t}(wt),kt=function(){function t(t){this.liquid=t}return t.prototype.parse=function(t){for(var e,n=[];e=t.shift();)n.push(this.parseToken(e,t));return n},t.prototype.parseToken=function(e,t){try{return"tag"===e.type?new yt(e,t,this.liquid):"output"===e.type?new xt(e,this.liquid.options.strict_filters):new _t(e)}catch(t){throw new n(t,e)}},t.prototype.parseStream=function(t){var n=this;return new Tt(t,function(t,e){return n.parseToken(t,e)})},t}(),St=new RegExp("("+B.source+")\\s*=([^]*)"),Rt={parse:function(t){var e=t.args.match(St);x(e,"illegal token "+t.raw),this.key=e[1],this.value=e[2]},render:function(t){var e=new F;return e[this.key]=this.liquid.evalValue(this.value,t),t.push(e),Promise.resolve("")}};function qt(n,r){var i=Promise.resolve(0),o=[];return n.forEach(function(t,e){i=i.then(function(){return r(t,e,n)}).then(function(t){return o.push(t)})}),i.then(function(){return o})}var Mt=new RegExp("^("+B.source+")\\s+in\\s+("+Z.source+")(?:\\s+"+tt.source+")*(?:\\s+(reversed))?(?:\\s+"+tt.source+")*$"),Ot={type:"block",parse:function(t,e){var n,r=this,i=Mt.exec(t.args);x(i,"illegal tag: "+t.raw),this.variable=i[1],this.collection=i[2],this.reversed=!!i[3],this.templates=[],this.elseTemplates=[];var o=this.liquid.parser.parseStream(e).on("start",function(){return n=r.templates}).on("tag:else",function(){return n=r.elseTemplates}).on("tag:endfor",function(){return o.stop()}).on("template",function(t){return n.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});o.start()},render:function(a,c){return p(this,void 0,void 0,function(){var r,e,n,i,o,s,u=this;return d(this,function(t){switch(t.label){case 0:return f(r=ft(this.collection,a))||(l(r)&&0<r.length?r=[r]:g(r)&&(r=Object.keys(r).map(function(t){return[t,r[t]]}))),f(r)&&r.length?(e=c.offset||0,n=void 0===c.limit?r.length:c.limit,r=r.slice(e,e+n),this.reversed&&r.reverse(),i=r.map(function(t,e){var n={};return n[u.variable]=t,n.forloop={first:0===e,index:e+1,index0:e,last:e===r.length-1,length:r.length,rindex:r.length-e,rindex0:r.length-e-1},n}),o="",s=!1,[4,qt(i,function(r){return p(u,void 0,void 0,function(){var e,n;return d(this,function(t){switch(t.label){case 0:if(s)return[2];a.push(r),t.label=1;case 1:return t.trys.push([1,3,,4]),e=o,[4,this.liquid.renderer.renderTemplates(this.templates,a)];case 2:return o=e+t.sent(),[3,4];case 3:if("RenderBreakError"!==(n=t.sent()).name)throw n;return o+=n.resolvedHTML,"break"===n.message&&(s=!0),[3,4];case 4:return a.pop(r),[2]}})})})]):[2,this.liquid.renderer.renderTemplates(this.elseTemplates,a)];case 1:return t.sent(),[2,o]}})})}},Lt=new RegExp("("+B.source+")"),At={parse:function(t,e){var n=this,r=t.args.match(Lt);x(r,t.args+" not valid identifier"),this.variable=r[1],this.templates=[];var i=this.liquid.parser.parseStream(e);i.on("tag:endcapture",function(){return i.stop()}).on("template",function(t){return n.templates.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")}),i.start()},render:function(r){return p(this,void 0,void 0,function(){var e,n;return d(this,function(t){switch(t.label){case 0:return[4,this.liquid.renderer.renderTemplates(this.templates,r)];case 1:return e=t.sent(),(n=new A)[this.variable]=e,r.push(n),[2]}})})}},Ft={parse:function(t,e){var n=this;this.cond=t.args,this.cases=[],this.elseTemplates=[];var r=[],i=this.liquid.parser.parseStream(e).on("tag:when",function(t){n.cases.push({val:t.args,templates:r=[]})}).on("tag:else",function(){return r=n.elseTemplates}).on("tag:endcase",function(){return i.stop()}).on("template",function(t){return r.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t){for(var e=0;e<this.cases.length;e++){var n=this.cases[e];if(ft(n.val,t)===ft(this.cond,t))return this.liquid.renderer.renderTemplates(n.templates,t)}return this.liquid.renderer.renderTemplates(this.elseTemplates,t)}},It={parse:function(t,e){var n=this.liquid.parser.parseStream(e);n.on("token",function(t){"endcomment"===t.name&&n.stop()}).on("end",function(){throw new Error("tag "+t.raw+" not closed")}),n.start()}},Nt=/[^\s,]+/,Pt=new RegExp("with\\s+("+Z.source+")"),Ut={parse:function(t){var e=Nt.exec(t.args);e&&(this.staticValue=e[0]),(e=Z.exec(t.args))&&(this.value=e[0]),(e=Pt.exec(t.args))&&(this.with=e[1])},render:function(u,a){return p(this,void 0,void 0,function(){var e,n,r,i,o,s;return d(this,function(t){switch(t.label){case 0:return u.opts.dynamicPartials?rt.exec(this.value)?(n=this.value.slice(1,-1),[4,this.liquid.parseAndRender(n,u.getAll(),u.opts)]):[3,2]:[3,4];case 1:return e=t.sent(),[3,3];case 2:e=ht(this.value,u),t.label=3;case 3:return[3,5];case 4:e=this.staticValue,t.label=5;case 5:return x(e,"cannot include with empty filename"),r=u.blocks,i=u.blockMode,u.blocks={},u.blockMode=M.OUTPUT,this.with&&(a[e]=ht(this.with,u)),[4,this.liquid.getTemplate(e,u.opts)];case 6:return o=t.sent(),u.push(a),[4,this.liquid.renderer.renderTemplates(o,u)];case 7:return s=t.sent(),u.pop(a),u.blocks=r,u.blockMode=i,[2,s]}})})}},jt={parse:function(t){var e=t.args.match(B);x(e,"illegal identifier "+t.args),this.variable=e[0]},render:function(t){var e=t.findContextFor(this.variable,function(t){return!(t instanceof A||t instanceof F)});return e||(e=new N,t.unshift(e)),"number"!=typeof e[this.variable]&&(e[this.variable]=0),--e[this.variable]}},Dt=new RegExp("^(?:("+Z.source+")\\s*:\\s*)?(.*)$"),Ht=new RegExp(Z.source,"g"),zt={parse:function(t){var e=Dt.exec(t.args);x(e,"illegal tag: "+t.raw),this.group=e[1]||"";var n=e[2];for(this.candidates=[];e=Ht.exec(n);)this.candidates.push(e[0]);x(this.candidates.length,"empty candidates: "+t.raw)},render:function(t){var e="cycle:"+ht(this.group,t)+":"+this.candidates.join(","),n=t.groups,r=n[e];void 0===r&&(r=n[e]=0);var i=this.candidates[r];return r=(r+1)%this.candidates.length,n[e]=r,ht(i,t)}},Ct={parse:function(t,e){var n,r=this;this.branches=[],this.elseTemplates=[];var i=this.liquid.parser.parseStream(e).on("start",function(){return r.branches.push({cond:t.args,templates:n=[]})}).on("tag:elsif",function(t){r.branches.push({cond:t.args,templates:n=[]})}).on("tag:else",function(){return n=r.elseTemplates}).on("tag:endif",function(){return i.stop()}).on("template",function(t){return n.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t){for(var e=0,n=this.branches;e<n.length;e++){var r=n[e];if(pt(ft(r.cond,t)))return this.liquid.renderer.renderTemplates(r.templates,t)}return this.liquid.renderer.renderTemplates(this.elseTemplates,t)}},Yt={parse:function(t){var e=t.args.match(B);x(e,"illegal identifier "+t.args),this.variable=e[0]},render:function(t){var e=t.findContextFor(this.variable,function(t){return!(t instanceof A||t instanceof F)});e||(e=new I,t.unshift(e)),"number"!=typeof e[this.variable]&&(e[this.variable]=0);var n=e[this.variable];return e[this.variable]++,n}},$t=/\S+/,Gt={parse:function(t,e){var n=$t.exec(t.args);n&&(this.staticLayout=n[0]),(n=Z.exec(t.args))&&(this.layout=n[0]),this.tpls=this.liquid.parser.parse(e)},render:function(o,s){return p(this,void 0,void 0,function(){var e,n,r,i;return d(this,function(t){switch(t.label){case 0:return x(e=o.opts.dynamicPartials?ht(this.layout,o):this.staticLayout,"cannot apply layout with empty filename"),o.blockMode=M.STORE,[4,this.liquid.renderer.renderTemplates(this.tpls,o)];case 1:return n=t.sent(),void 0===o.blocks[""]&&(o.blocks[""]=n),[4,this.liquid.getTemplate(e,o.opts)];case 2:return r=t.sent(),o.push(s),o.blockMode=M.OUTPUT,[4,this.liquid.renderer.renderTemplates(r,o)];case 3:return i=t.sent(),o.pop(s),[2,i]}})})}},Bt={parse:function(t,e){var n=this,r=/\w+/.exec(t.args);this.block=r?r[0]:"",this.tpls=[];var i=this.liquid.parser.parseStream(e).on("tag:endblock",function(){return i.stop()}).on("template",function(t){return n.tpls.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(i){return p(this,void 0,void 0,function(){var e,n,r;return d(this,function(t){switch(t.label){case 0:return void 0===(e=i.blocks[this.block])?[3,1]:(r=e,[3,3]);case 1:return[4,this.liquid.renderer.renderTemplates(this.tpls,i)];case 2:r=t.sent(),t.label=3;case 3:return n=r,i.blockMode===M.STORE?(i.blocks[this.block]=n,[2,""]):[2,n]}})})}},Vt={parse:function(t,e){var n=this;this.tokens=[];var r=this.liquid.parser.parseStream(e);r.on("token",function(t){"endraw"===t.name?r.stop():n.tokens.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")}),r.start()},render:function(){return this.tokens.map(function(t){return t.raw}).join("")}},Wt=new RegExp("^("+B.source+")\\s+in\\s+("+Z.source+")(?:\\s+"+tt.source+")*$"),Jt={assign:Rt,for:Ot,capture:At,case:Ft,comment:It,include:Ut,decrement:jt,increment:Yt,cycle:zt,if:Ct,layout:Gt,block:Bt,raw:Vt,tablerow:{parse:function(t,e){var n,r=this,i=Wt.exec(t.args);x(i,"illegal tag: "+t.raw),this.variable=i[1],this.collection=i[2],this.templates=[];var o=this.liquid.parser.parseStream(e).on("start",function(){return n=r.templates}).on("tag:endtablerow",function(){return o.stop()}).on("template",function(t){return n.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});o.start()},render:function(c,l){return p(this,void 0,void 0,function(){var e,n,r,o,i,s,u,a=this;return d(this,function(t){switch(t.label){case 0:return e=ft(this.collection,c)||[],n=l.offset||0,r=void 0===l.limit?e.length:l.limit,e=e.slice(n,n+r),o=l.cols||e.length,i=e.map(function(t){var e={};return e[a.variable]=t,e}),s=0,u="",[4,qt(i,function(r,i){return p(a,void 0,void 0,function(){var e,n;return d(this,function(t){switch(t.label){case 0:return s=Math.floor(i/o)+1,1===(e=i%o+1)&&(1!==s&&(u+="</tr>"),u+='<tr class="row'+s+'">'),u+='<td class="col'+e+'">',c.push(r),n=u,[4,this.liquid.renderer.renderTemplates(this.templates,c)];case 1:return u=n+t.sent(),u+="</td>",c.pop(r),[2,u]}})})})];case 1:return t.sent(),0<s&&(u+="</tr>"),[2,u]}})})}},unless:{parse:function(t,e){var n,r=this;this.templates=[],this.elseTemplates=[];var i=this.liquid.parser.parseStream(e).on("start",function(){n=r.templates,r.cond=t.args}).on("tag:else",function(){return n=r.elseTemplates}).on("tag:endunless",function(){return i.stop()}).on("template",function(t){return n.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t){return dt(ft(this.cond,t))?this.liquid.renderer.renderTemplates(this.templates,t):this.liquid.renderer.renderTemplates(this.elseTemplates,t)}},break:{render:function(){return p(this,void 0,void 0,function(){return d(this,function(t){throw new T("break")})})}},continue:{render:function(){return p(this,void 0,void 0,function(){return d(this,function(t){throw new T("continue")})})}}},Xt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&#34;","'":"&#39;"},Kt={"&amp;":"&","&lt;":"<","&gt;":">","&#34;":'"',"&#39;":"'"};function Qt(t){return String(t).replace(/&|<|>|"|'/g,function(t){return Xt[t]})}var Zt={escape:Qt,escape_once:function(t){return Qt(String(t).replace(/&(amp|lt|gt|#34|#39);/g,function(t){return Kt[t]}))},newline_to_br:function(t){return t.replace(/\n/g,"<br />")},strip_html:function(t){return t.replace(/<script.*?<\/script>|<!--.*?-->|<style.*?<\/style>|<.*?>/g,"")}},te={append:function(t,e){return t+e},prepend:function(t,e){return e+t},capitalize:function(t){return String(t).charAt(0).toUpperCase()+t.slice(1)},lstrip:function(t){return String(t).replace(/^\s+/,"")},downcase:function(t){return t.toLowerCase()},upcase:function(t){return String(t).toUpperCase()},remove:function(t,e){return t.split(e).join("")},remove_first:function(t,e){return t.replace(e,"")},replace:function(t,e,n){return String(t).split(e).join(n)},replace_first:function(t,e,n){return String(t).replace(e,n)},rstrip:function(t){return String(t).replace(/\s+$/,"")},split:function(t,e){return String(t).split(e)},strip:function(t){return String(t).trim()},strip_newlines:function(t){return String(t).replace(/\n/g,"")},truncate:function(t,e,n){return void 0===e&&(e=50),void 0===n&&(n="..."),(t=String(t)).length<=e?t:t.substr(0,e-n.length)+n},truncatewords:function(t,e,n){void 0===e&&(e=15),void 0===n&&(n="...");var r=t.split(/\s+/),i=r.slice(0,e).join(" ");return r.length>=e&&(i+=n),i}},ee={abs:function(t){return Math.abs(t)},ceil:function(t){return Math.ceil(t)},divided_by:function(t,e){return t/e},floor:function(t){return Math.floor(t)},minus:re(function(t,e){return t-e}),modulo:re(function(t,e){return t%e}),round:function(t,e){void 0===e&&(e=0);var n=Math.pow(10,e);return Math.round(t*n)/n},plus:re(function(t,e){return Number(t)+Number(e)}),times:function(t,e){return t*e}};function ne(t){var e=String(t).split(".");return 1<e.length?e[1].length:0}function re(r){return function(t,e){var n=Math.max(ne(t),ne(e));return r(t,e).toFixed(n)}}var ie={url_decode:function(t){return t.split("+").map(decodeURIComponent).join(" ")},url_encode:function(t){return t.split(" ").map(encodeURIComponent).join("+")}},oe={join:function(t,e){return t.join(void 0===e?" ":e)},last:function(t){return h(t)},first:function(t){return t[0]},map:function(t,e){return t.map(function(t){return t[e]})},reverse:function(t){return t.reverse()},sort:function(t,e){return t.sort(e)},size:function(t){return t.length},concat:function(t,e){return Array.prototype.concat.call(t,e)},slice:function(t,e,n){return void 0===n&&(n=1),t.slice(e,e+n)},uniq:function(t){var e={};return(t||[]).filter(function(t){return!e.hasOwnProperty(String(t))&&(e[String(t)]=!0)})}},se=["January","February","March","April","May","June","July","August","September","October","November","December"],ue=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ae=se.map(fe),ce=ue.map(fe),le={1:"st",2:"nd",3:"rd",default:"th"};function fe(t){return t.slice(0,3)}var he={daysInMonth:function(t){return[31,he.isLeapYear(t)?29:28,31,30,31,30,31,31,30,31,30,31]},getDayOfYear:function(t){for(var e=0,n=0;n<t.getMonth();++n)e+=he.daysInMonth(t)[n];return e+t.getDate()},getWeekOfYear:function(t,e){var n=this.getDayOfYear(t)+(e-t.getDay()),r=7-new Date(t.getFullYear(),0,1).getDay()+e;return w(String(Math.floor((n-r)/7)+1),2,"0")},isLeapYear:function(t){var e=t.getFullYear();return!(0!=(3&e)||!(e%100||e%400==0&&e))},getSuffix:function(t){var e=t.getDate().toString(),n=parseInt(e.slice(-1));return le[n]||le.default},century:function(t){return parseInt(t.getFullYear().toString().substring(0,2),10)}},pe={a:function(t){return ce[t.getDay()]},A:function(t){return ue[t.getDay()]},b:function(t){return ae[t.getMonth()]},B:function(t){return se[t.getMonth()]},c:function(t){return t.toLocaleString()},C:function(t){return he.century(t)},d:function(t){return w(t.getDate(),2,"0")},e:function(t){return w(t.getDate(),2)},H:function(t){return w(t.getHours(),2,"0")},I:function(t){return w(String(t.getHours()%12||12),2,"0")},j:function(t){return w(he.getDayOfYear(t),3,"0")},k:function(t){return w(t.getHours(),2)},l:function(t){return w(String(t.getHours()%12||12),2)},L:function(t){return w(t.getMilliseconds(),3,"0")},m:function(t){return w(t.getMonth()+1,2,"0")},M:function(t){return w(t.getMinutes(),2,"0")},p:function(t){return t.getHours()<12?"AM":"PM"},P:function(t){return t.getHours()<12?"am":"pm"},q:function(t){return he.getSuffix(t)},s:function(t){return Math.round(t.valueOf()/1e3)},S:function(t){return w(t.getSeconds(),2,"0")},u:function(t){return t.getDay()||7},U:function(t){return he.getWeekOfYear(t,0)},w:function(t){return t.getDay()},W:function(t){return he.getWeekOfYear(t,1)},x:function(t){return t.toLocaleDateString()},X:function(t){return t.toLocaleTimeString()},y:function(t){return t.getFullYear().toString().substring(2,4)},Y:function(t){return t.getFullYear()},z:function(t){var e=t.getTimezoneOffset()/60*100;return(0<e?"-":"+")+w(String(Math.abs(e)),4,"0")},"%":function(){return"%"}};pe.h=pe.b,pe.N=pe.L;var de=v({},Zt,te,ee,ie,{date:function(t,e){var n,r=t;return"now"===t?r=new Date:l(t)&&(r=new Date(t)),(n=r)instanceof Date&&!isNaN(n.getTime())?function(t,e){for(var n="",r=e;;){var i=/%./g,o=i.exec(r);if(!o)return n+r;n+=r.slice(0,i.lastIndex-2),r=r.slice(i.lastIndex);var s=o[0].charAt(1),u=pe[s];n+=u?u(t):"%"+s}}(r,e):t}},{default:function(t,e){return pt(t)?t:e}},oe);return function(){function e(t){void 0===t&&(t={});var n=this;this.cache={},this.options=q(R(t)),this.parser=new kt(this),this.renderer=new ct,this.tokenizer=new at(this.options),c(Jt,function(t,e){return n.registerTag(e,t)}),c(de,function(t,e){return n.registerFilter(e,t)})}return e.prototype.parse=function(t,e){var n=this.tokenizer.tokenize(t,e);return this.parser.parse(n)},e.prototype.render=function(t,e,n){var r=v({},this.options,R(n)),i=new O(e,r);return this.renderer.renderTemplates(t,i)},e.prototype.parseAndRender=function(n,r,i){return p(this,void 0,void 0,function(){var e;return d(this,function(t){switch(t.label){case 0:return[4,this.parse(n)];case 1:return e=t.sent(),[2,this.render(e,r,i)]}})})},e.prototype.getTemplate=function(f,h){return p(this,void 0,void 0,function(){var e,n,r,i,o,s,u,a,c,l=this;return d(this,function(t){switch(t.label){case 0:e=R(h),n=e.root?e.root.concat(this.options.root):this.options.root,r=n.map(function(t){return U.resolve(t,f,l.options.extname)}),i=0,o=r,t.label=1;case 1:return i<o.length?(s=o[i],[4,U.exists(s)]):[3,5];case 2:return t.sent()?this.options.cache&&this.cache[s]?[2,this.cache[s]]:(a=this.parse,[4,U.readFile(s)]):[3,4];case 3:return u=a.apply(this,[t.sent(),s]),this.options.cache&&(this.cache[s]=u),[2,u];case 4:return i++,[3,1];case 5:throw(c=new Error("ENOENT")).message='ENOENT: Failed to lookup "'+f+'" in "'+n+'"',c.code="ENOENT",c}})})},e.prototype.renderFile=function(r,i,o){return p(this,void 0,void 0,function(){var e,n;return d(this,function(t){switch(t.label){case 0:return e=R(o),[4,this.getTemplate(r,e)];case 1:return n=t.sent(),[2,this.render(n,i,o)]}})})},e.prototype.evalValue=function(t,e){return new Et(t,this.options.strict_filters).value(e)},e.prototype.registerFilter=function(t,e){return bt.register(t,e)},e.prototype.registerTag=function(t,e){return yt.register(t,e)},e.prototype.plugin=function(t){return t.call(this,e)},e.prototype.express=function(){var i=this;return function(t,e,n){var r={root:this.root};i.renderFile(t,e,r).then(function(t){return n(null,t)},n)}},(e.default=e).isTruthy=pt,e.isFalsy=dt,e.evalExp=ft,e.evalValue=ht,e.Types=P,e}()});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Liquid=e()}(this,function(){"use strict";var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function i(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var v=function(){return(v=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function h(o,u,s,a){return new(s||(s=Promise))(function(t,e){function n(t){try{i(a.next(t))}catch(t){e(t)}}function r(t){try{i(a.throw(t))}catch(t){e(t)}}function i(e){e.done?t(e.value):new s(function(t){t(e.value)}).then(n,r)}i((a=a.apply(o,u||[])).next())})}function d(n,r){var i,o,u,t,s={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,o&&(u=2&e[0]?o.return:e[0]?o.throw||((u=o.return)&&u.call(o),0):o.next)&&!(u=u.call(o,e[1])).done)return u;switch(o=0,u&&(e=[2&e[0],u.value]),e[0]){case 0:case 1:u=e;break;case 4:return s.label++,{value:e[1],done:!1};case 5:s.label++,o=e[1],e=[0];continue;case 7:e=s.ops.pop(),s.trys.pop();continue;default:if(!(u=0<(u=s.trys).length&&u[u.length-1])&&(6===e[0]||2===e[0])){s=0;continue}if(3===e[0]&&(!u||e[1]>u[0]&&e[1]<u[3])){s.label=e[1];break}if(6===e[0]&&s.label<u[1]){s.label=u[1],u=e;break}if(u&&s.label<u[2]){s.label=u[2],s.ops.push(e);break}u[2]&&s.ops.pop(),s.trys.pop();continue}e=r.call(n,s)}catch(t){e=[6,t],o=0}finally{i=u=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}var o=Object.prototype.toString,u=Array.prototype.toString;function l(t){return"[object String]"===o.call(t)}function s(t){return"function"==typeof t}function a(t){return c(t)?"":s(t.to_liquid)?a(t.to_liquid()):s(t.toLiquid)?a(t.toLiquid()):s(t.to_s)?t.to_s():-1<[o,u].indexOf(t.toString)?(e=t,n=[],JSON.stringify(e,function(t,e){if(m(e)){if(-1!==n.indexOf(e))return;n.push(e)}return e})):s(t.toString)?t.toString():o.call(t);var e,n}function c(t){return null==t}function f(t){return"[object Array]"===o.call(t)}function p(t,e){for(var n in t=t||{})if(t.hasOwnProperty(n)&&!1===e(t[n],n,t))break;return t}function g(t){return t[t.length-1]}function m(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function y(t,e,n){void 0===e&&(e=t,t=0),n=n||1;for(var r=[],i=t;i<e;i+=n)r.push(i);return r}function w(t,e,n){void 0===n&&(n=" ");for(var r=e-(t=String(t)).length;0<r--;)t=n+t;return t}var t=function(r){function t(t,e){var n=r.call(this,t.message)||this;return n.originalError=t,n.token=e,n}return i(t,r),t.prototype.update=function(){var i,o,t,u,e=this.originalError,n=(i=this.token,o=i.input.split("\n"),t=Math.max(i.line-2,1),u=Math.min(i.line+3,o.length),y(t,u+1).map(function(t){var e=t===i.line?">> ":" ",n=w(String(t),String(u).length),r=o[t-1];return""+e+n+"| "+r}).join("\n"));this.message=function(t,e){e.file&&(t+=", file:"+e.file);return t+=", line:"+e.line+", col:"+e.col}(e.message,this.token),this.stack=this.message+"\n"+n+"\n"+this.stack+"\nFrom "+e.stack},t}(Error),b=function(r){function t(t,e){var n=r.call(this,new Error(t),e)||this;return n.name="TokenizationError",r.prototype.update.call(n),n}return i(t,r),t}(t),n=function(r){function t(t,e){var n=r.call(this,t,e)||this;return n.name="ParseError",n.message=t.message,r.prototype.update.call(n),n}return i(t,r),t}(t),T=function(r){function t(t,e){var n=r.call(this,t,e.token)||this;return n.name="RenderError",n.message=t.message,r.prototype.update.call(n),n}return i(t,r),t}(t),e=function(n){function t(t){var e=n.call(this,t)||this;return e.resolvedHTML="",e.name="RenderBreakError",e.message=t+"",e}return i(t,n),t}(Error),E=function(n){function t(t){var e=n.call(this,t)||this;return e.name="AssertionError",e.message=t+"",e}return i(t,n),t}(Error);function x(t,e){if(!t)throw new E(e=e||"expect "+t+" to be true")}var k,_,q={root:["."],cache:!1,extname:"",dynamicPartials:!0,trim_tag_right:!1,trim_tag_left:!1,trim_output_right:!1,trim_output_left:!1,greedy:!0,tag_delimiter_left:"{%",tag_delimiter_right:"%}",output_delimiter_left:"{{",output_delimiter_right:"}}",strict_filters:!1,strict_variables:!1};function S(t){var e;return(t=t||{}).hasOwnProperty("root")&&(t.root=f(e=t.root)?e:l(e)?[e]:[]),t}function R(t){return v({},q,t)}(_=k||(k={}))[_.OUTPUT=0]="OUTPUT",_[_.STORE=1]="STORE";var M=k,O=function(){function t(t,e){void 0===t&&(t={}),this.blocks={},this.groups={},this.blockMode=M.OUTPUT,this.opts=R(e),this.contexts=[t||{}]}return t.prototype.getAll=function(){return this.contexts.reduce(function(t,e){return v(t,e)},{})},t.prototype.get=function(t){var n=this,e=this.propertyAccessSeq(t),r=this.findContextFor(e[0])||g(this.contexts);return e.reduce(function(t,e){return n.readProperty(t,e)},r)},t.prototype.set=function(t,n){var r=this.propertyAccessSeq(t),i=this.findContextFor(r[0])||g(this.contexts);r.some(function(t,e){return!m(i)||(e===r.length-1?(i[t]=n,!0):(void 0===i[t]&&(i[t]={}),i=i[t],!1))})},t.prototype.unshift=function(t){return this.contexts.unshift(t)},t.prototype.push=function(t){return this.contexts.push(t)},t.prototype.pop=function(e){if(!arguments.length)return this.contexts.pop();var t=this.contexts.findIndex(function(t){return t===e});if(-1===t)throw new TypeError("scope not found, cannot pop");return this.contexts.splice(t,1)[0]},t.prototype.findContextFor=function(t,e){void 0===e&&(e=function(){return!0});for(var n=this.contexts.length-1;0<=n;n--){var r=this.contexts[n];if(e(r)&&t in r)return r}return null},t.prototype.readProperty=function(t,e){var n,r;if(c(t)?n=t:(t=function(t){if(s(t.to_liquid))return t.to_liquid();if(s(t.toLiquid))return t.toLiquid();return t}(t),n="size"===e?c((r=t).size)&&(f(r)||l(r))?r.length:r.size:t[e],s(t.liquid_method_missing)&&(n=t.liquid_method_missing(e))),c(n)&&this.opts.strict_variables)throw new TypeError("undefined variable: "+e);return n},t.prototype.propertyAccessSeq=function(t){t=String(t);for(var e,n=[],r="",i=0;i<t.length;)switch(t[i]){case"[":u();var o=t[i+1];i=/['"]/.test(o)?(x(-1!==(e=t.indexOf(o,i+2)),"unbalanced "+o+": "+t),r=t.slice(i+2,e),u(),e+2):(x(-1!==(e=L(t,i+1)),"unbalanced []: "+t),r=t.slice(i+1,e),/^[+-]?\d+$/.test(r)||(r=String(this.get(r))),u(),e+1);break;case".":u(),i++;break;default:r+=t[i],i++}if(u(),!n.length)throw new TypeError('invalid path:"'+t+'"');return n;function u(){r.length&&n.push(r),r=""}},t}();function L(t,e){for(var n=1,r=e;r<t.length;r++)if("["===t[r]&&n++,"]"===t[r]&&0===--n)return r;return-1}var A=function(){},F=function(){},I=function(){},N=function(){},P=Object.freeze({AssignScope:F,CaptureScope:A,IncrementScope:I,DecrementScope:N,ParseError:n,TokenizationError:b,RenderBreakError:e,AssertionError:E});var U={readFile:function(r){return h(this,void 0,void 0,function(){return d(this,function(t){return[2,new Promise(function(t,e){var n=new XMLHttpRequest;n.onload=function(){200<=n.status&&n.status<300?t(n.responseText):e(new Error(n.statusText))},n.onerror=function(){e(new Error("An error occurred whilst receiving the response."))},n.open("GET",r),n.send()})]})})},resolve:function(t,e,i){return t.length&&"/"!==g(t)&&(t+="/"),function(t,e){var n=document.createElement("base");n.href=t;var r=document.getElementsByTagName("head")[0];r.insertBefore(n,r.firstChild);var i=document.createElement("a");i.href=e;var o=i.href;return r.removeChild(n),o}(t,e).replace(/^(\w+:\/\/[^/]+)(\/[^?]+)/,function(t,e,n){var r=n.split("/").pop();return/\.\w+$/.test(r)?t:e+n+i})},exists:function(){return h(this,void 0,void 0,function(){return d(this,function(t){return[2,!0]})})}};var j,D,H=function(t,e,n,r,i){this.type="notset",this.col=r,this.line=n,this.raw=t,this.value=t,this.input=e,this.file=i},z=function(u){function t(t,e,n,r,i){var o=u.call(this,t,e,n,r,i)||this;return o.type="html",o.value=t,o}return i(t,u),t}(H),C=function(s){function t(t,e,n,r,i,o){var u=s.call(this,t,n,r,i,o)||this;return u.trimLeft="-"===e[0],u.trimRight="-"===g(e),u.value=e.slice(u.trimLeft?1:0,u.trimRight?-1:e.length).trim(),u}return i(t,s),t}(H),Y=new RegExp(/'[^']*'/.source+"|"+/"[^"]*"/.source),$=new RegExp("(?:"+Y.source+"|[^'\"])*"),G=/[+-]?(?:\d+\.?\d*|\.?\d+)/,B=/[\w-]+[?]?/,V=new RegExp("\\[(?:"+Y.source+"|[\\w-\\.]+)\\]"),W=new RegExp("(?:"+Y.source+"|"+/true|false/.source+"|"+G.source+")"),J=new RegExp(B.source+"(?:\\."+B.source+"|"+V.source+")*"),X=new RegExp("(?:"+J.source+"|"+G.source+")"),K=new RegExp("\\("+X.source+"\\.\\."+X.source+"\\)"),Q=new RegExp("\\(("+X.source+")\\.\\.("+X.source+")\\)"),Z=new RegExp("(?:"+J.source+"|"+W.source+"|"+K.source+")"),tt=new RegExp("(?:"+B.source+")\\s*:\\s*(?:"+Z.source+")"),et=new RegExp("("+B.source+")\\s*:\\s*("+Z.source+")","g"),nt=new RegExp("^\\s*("+B.source+")\\s*([\\s\\S]*?)\\s*$"),rt=new RegExp("^"+Y.source+"$"),it=new RegExp("^"+Q.source+"$"),ot=[/\s+or\s+/,/\s+and\s+/,/==|!=|<=|>=|<|>|\s+contains\s+/],ut=function(a){function t(t,e,n,r,i,o){var u=a.call(this,t,e,n,r,i,o)||this;u.type="tag";var s=u.value.match(nt);if(!s)throw new b("illegal tag syntax",u);return u.name=s[1],u.args=s[2],u}return i(t,a),t}(C),st=function(s){function t(t,e,n,r,i,o){var u=s.call(this,t,e,n,r,i,o)||this;return u.type="output",u}return i(t,s),t}(C);(D=j||(j={}))[D.HTML=0]="HTML",D[D.OUTPUT=1]="OUTPUT",D[D.TAG=2]="TAG";var at=function(){function t(t){this.options=R(t)}return t.prototype.tokenize=function(t,e){for(var n=[],r=this.options.tag_delimiter_left,i=this.options.tag_delimiter_right,o=this.options.output_delimiter_left,u=this.options.output_delimiter_right,s=0,a=1,c=j.HTML,l="",f=0,p=1,h=1;s<t.length;){if("\n"===t[s]&&(a++,f=s+1),c===j.HTML){if(t.substr(s,o.length)===o){l&&n.push(new z(l,t,p,h,e)),p=a,h=s-f+1,s+=(l=o).length,c=j.OUTPUT;continue}if(t.substr(s,r.length)===r){l&&n.push(new z(l,t,p,h,e)),p=a,h=s-f+1,s+=(l=r).length,c=j.TAG;continue}}else{if(c===j.OUTPUT&&t.substr(s,u.length)===u){l+=u,n.push(new st(l,l.slice(o.length,-u.length),t,p,h,e)),l="",p=a,h=(s+=u.length)-f+1,c=j.HTML;continue}if(t.substr(s,i.length)===i){l+=i,n.push(new ut(l,l.slice(r.length,-i.length),t,p,h,e)),l="",p=a,h=(s+=i.length)-f+1,c=j.HTML;continue}}l+=t[s++]}if(c===j.HTML)return l&&n.push(new z(l,t,p,h,e)),function(u,s){s=v({greedy:!0},s);var a=!1;u.forEach(function(t,e){var n,r,i,o;i=t,o=s,!a&&("tag"===i.type?i.trimLeft||o.trim_tag_left:"output"===i.type?i.trimLeft||o.trim_output_left:void 0)&&function(t,e){if(t&&"html"===t.type){var n=e?/\s+$/g:/[\t\r ]*$/g;t.value=t.value.replace(n,"")}}(u[e-1],s.greedy),"tag"===t.type&&"raw"===t.name&&(a=!0),"tag"===t.type&&"endraw"===t.name&&(a=!1),n=t,r=s,!a&&("tag"===n.type?n.trimRight||r.trim_tag_right:"output"===n.type?n.trimRight||r.trim_output_right:void 0)&&function(t,e){if(t&&"html"===t.type){var n=e?/^\s+/g:/^[\t\r ]*\n?/g;t.value=t.value.replace(n,"")}}(u[e+1],s.greedy)})}(n,this.options),n;var d=c===j.OUTPUT?"output":"tag",g=16<l.length?l.slice(0,13)+"...":l;throw new b(d+' "'+g+'" not closed',new H(l,t,p,h,e))},t}(),ct=function(){function t(){}return t.prototype.renderTemplates=function(s,a){return h(this,void 0,void 0,function(){var e,n,r,i,o,u;return d(this,function(t){switch(t.label){case 0:x(a,"unable to evalTemplates: scope undefined"),e="",n=0,r=s,t.label=1;case 1:if(!(n<r.length))return[3,6];i=r[n],t.label=2;case 2:return t.trys.push([2,4,,5]),o=e,[4,i.render(a)];case 3:return e=o+t.sent(),[3,5];case 4:if("RenderBreakError"===(u=t.sent()).name)throw u.resolvedHTML=e,u;throw"RenderError"===u.name?u:new T(u,i);case 5:return n++,[3,1];case 6:return[2,e]}})})},t}();function lt(t){return t&&s(t.equals)}var ft=function(){};function pt(t){return t instanceof ft&&s(t.value)}var ht=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.equals=function(t){return l(t)||f(t)?0===t.length:!!m(t)&&0===Object.keys(t).length},e.prototype.gt=function(){return!1},e.prototype.geq=function(){return!1},e.prototype.lt=function(){return!1},e.prototype.leq=function(){return!1},e.prototype.value=function(){return""},e}(ft),dt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.equals=function(t){return!1===t||(!!c(pt(t)?t.value():t)||(l(t)?/^\s*$/.test(t):e.prototype.equals.call(this,t)))},t}(ht),gt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.equals=function(t){return c(pt(t)?t.value():t)||t instanceof dt},e.prototype.gt=function(){return!1},e.prototype.geq=function(){return!1},e.prototype.lt=function(){return!1},e.prototype.leq=function(){return!1},e.prototype.value=function(){return null},e}(ft),vt={"==":function(t,e){return lt(t)?t.equals(e):lt(e)?e.equals(t):t===e},"!=":function(t,e){return lt(t)?!t.equals(e):lt(e)?!e.equals(t):t!==e},">":function(t,e){return lt(t)?t.gt(e):lt(e)?e.lt(t):e<t},"<":function(t,e){return lt(t)?t.lt(e):lt(e)?e.gt(t):t<e},">=":function(t,e){return lt(t)?t.geq(e):lt(e)?e.leq(t):e<=t},"<=":function(t,e){return lt(t)?t.leq(e):lt(e)?e.geq(t):t<=e},contains:function(t,e){return!!t&&("function"==typeof t.indexOf&&-1<t.indexOf(e))},and:function(t,e){return bt(t)&&bt(e)},or:function(t,e){return bt(t)||bt(e)}};function mt(t,e){var n=function t(e,n){x(n,"unable to parseExp: scope undefined");for(var r,i=ot,o=0;o<i.length;o++){var u=i[o],s=new RegExp("^("+$.source+")("+u.source+")("+$.source+")$");if(r=e.match(s)){var a=t(r[1],n);return(0,vt[r[2].trim()])(a,t(r[3],n))}}return(r=e.match(it))?y(yt(r[1],n),yt(r[2],n)+1):yt(e,n)}(t,e);return pt(n)?n.value():n}function yt(t,e){return t?"true"===(t=t.trim())||"false"!==t&&("nil"===t||"null"===t?new gt:"empty"===t?new ht:"blank"===t?new dt:isNaN(Number(t))?'"'!==t[0]&&"'"!==t[0]||t[0]!==g(t)?e.get(t):t.slice(1,-1):Number(t)):null}function wt(t,e){var n=yt(t,e);return pt(n)?n.value():n}function bt(t){return!Tt(t)}function Tt(t){return!1===t||null==t}var Et,xt,kt=function(t,e){var n;for(et.lastIndex=0;n=et.exec(t);){var r=n[1],i=n[2];this[r]=wt(i,e)}},_t=function(t){this.token=t},qt=function(u){function s(t,e,n){var r=u.call(this,t)||this;r.name=t.name;var i,o=s.impls[t.name];return x(o,"tag "+t.name+" not found"),r.impl=(i=o,Object.create(i)),r.impl.liquid=n,r.impl.parse&&r.impl.parse(t,e),r}return i(s,u),s.prototype.render=function(r){return h(this,void 0,void 0,function(){var e,n;return d(this,function(t){switch(t.label){case 0:return e=new kt(this.token.args,r),"function"!=typeof(n=this.impl).render?[2,""]:[4,n.render(r,e)];case 1:return[2,a(t.sent())]}})})},s.register=function(t,e){s.impls[t]=e},s.clear=function(){s.impls={}},s.impls={},s}(_t),St=function(){function i(t,e,n){var r=i.impls[t];if(!r&&n)throw new TypeError("undefined filter: "+t);this.name=t,this.impl=r||function(t){return t},this.args=e}return i.prototype.render=function(t,e){var n=this.args.map(function(t){return wt(t,e)});return this.impl.apply(null,[t].concat(n))},i.register=function(t,e){i.impls[t]=e},i.clear=function(){i.impls={}},i.impls={},i}(),Rt=function(){function t(t,e){this.handlers={},this.stopRequested=!1,this.tokens=t,this.parseToken=e}return t.prototype.on=function(t,e){return this.handlers[t]=e,this},t.prototype.trigger=function(t,e){var n=this.handlers[t];return"function"==typeof n&&(n(e),!0)},t.prototype.start=function(){var t;for(this.trigger("start");!this.stopRequested&&(t=this.tokens.shift());)if(!(this.trigger("token",t)||"tag"===t.type&&this.trigger("tag:"+t.name,t))){var e=this.parseToken(t,this.tokens);this.trigger("template",e)}return this.stopRequested||this.trigger("end"),this},t.prototype.stop=function(){return this.stopRequested=!0,this},t}();(xt=Et||(Et={}))[xt.INIT=0]="INIT",xt[xt.FILTER_NAME=1]="FILTER_NAME",xt[xt.FILTER_ARG=2]="FILTER_ARG";var Mt=function(){function t(t,e){this.filters=[];for(var n="",r="",i=Et.INIT,o=!1,u="",s=[],a=0;a<t.length;a++)if(r)t[a]===r&&(o=!(r="")),n+=t[a];else if(/\s/.test(t[a])){if(!n)continue;o=!0}else if("|"===t[a])i===Et.INIT?this.initial=n:(i===Et.FILTER_NAME?u=n:s.push(n),this.filters.push(new St(u,s,e)),u="",s=[]),i=Et.FILTER_NAME,n="",o=!1;else if(i===Et.FILTER_NAME&&":"===t[a])u=n,i=Et.FILTER_ARG,n="",o=!1;else if(i===Et.FILTER_ARG&&","===t[a])s.push(n),n="",o=!1;else{if(o)continue;'"'!==t[a]&&"'"!==t[a]||r||(r=t[a]),n+=t[a]}n&&(i===Et.INIT?this.initial=n:i===Et.FILTER_NAME?this.filters.push(new St(n,[],e)):(s.push(n),this.filters.push(new St(u,s,e))))}return t.prototype.value=function(n){return this.filters.reduce(function(t,e){return e.render(t,n)},mt(this.initial,n))},t}(),Ot=function(r){function t(t,e){var n=r.call(this,t)||this;return n.value=new Mt(t.value,e),n}return i(t,r),t.prototype.render=function(e){return h(this,void 0,void 0,function(){return d(this,function(t){switch(t.label){case 0:return[4,this.value.value(e)];case 1:return[2,a(t.sent())]}})})},t}(_t),Lt=function(n){function t(t){var e=n.call(this,t)||this;return e.str=t.value,e}return i(t,n),t.prototype.render=function(){return h(this,void 0,void 0,function(){return d(this,function(t){return[2,this.str]})})},t}(_t),At=function(){function t(t){this.liquid=t}return t.prototype.parse=function(t){for(var e,n=[];e=t.shift();)n.push(this.parseToken(e,t));return n},t.prototype.parseToken=function(e,t){try{return"tag"===e.type?new qt(e,t,this.liquid):"output"===e.type?new Ot(e,this.liquid.options.strict_filters):new Lt(e)}catch(t){throw new n(t,e)}},t.prototype.parseStream=function(t){var n=this;return new Rt(t,function(t,e){return n.parseToken(t,e)})},t}(),Ft=new RegExp("("+B.source+")\\s*=([^]*)"),It={parse:function(t){var e=t.args.match(Ft);x(e,"illegal token "+t.raw),this.key=e[1],this.value=e[2]},render:function(t){var e=new F;return e[this.key]=this.liquid.evalValue(this.value,t),t.push(e),Promise.resolve("")}};function Nt(n,r){var i=Promise.resolve(0),o=[];return n.forEach(function(t,e){i=i.then(function(){return r(t,e,n)}).then(function(t){return o.push(t)})}),i.then(function(){return o})}var Pt=new RegExp("^("+B.source+")\\s+in\\s+("+Z.source+")(?:\\s+"+tt.source+")*(?:\\s+(reversed))?(?:\\s+"+tt.source+")*$"),Ut={type:"block",parse:function(t,e){var n,r=this,i=Pt.exec(t.args);x(i,"illegal tag: "+t.raw),this.variable=i[1],this.collection=i[2],this.reversed=!!i[3],this.templates=[],this.elseTemplates=[];var o=this.liquid.parser.parseStream(e).on("start",function(){return n=r.templates}).on("tag:else",function(){return n=r.elseTemplates}).on("tag:endfor",function(){return o.stop()}).on("template",function(t){return n.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});o.start()},render:function(a,c){return h(this,void 0,void 0,function(){var r,e,n,i,o,u,s=this;return d(this,function(t){switch(t.label){case 0:return f(r=mt(this.collection,a))||(l(r)&&0<r.length?r=[r]:m(r)&&(r=Object.keys(r).map(function(t){return[t,r[t]]}))),f(r)&&r.length?(e=c.offset||0,n=void 0===c.limit?r.length:c.limit,r=r.slice(e,e+n),this.reversed&&r.reverse(),i=r.map(function(t,e){var n={};return n[s.variable]=t,n.forloop={first:0===e,index:e+1,index0:e,last:e===r.length-1,length:r.length,rindex:r.length-e,rindex0:r.length-e-1},n}),o="",u=!1,[4,Nt(i,function(r){return h(s,void 0,void 0,function(){var e,n;return d(this,function(t){switch(t.label){case 0:if(u)return[2];a.push(r),t.label=1;case 1:return t.trys.push([1,3,,4]),e=o,[4,this.liquid.renderer.renderTemplates(this.templates,a)];case 2:return o=e+t.sent(),[3,4];case 3:if("RenderBreakError"!==(n=t.sent()).name)throw n;return o+=n.resolvedHTML,"break"===n.message&&(u=!0),[3,4];case 4:return a.pop(r),[2]}})})})]):[2,this.liquid.renderer.renderTemplates(this.elseTemplates,a)];case 1:return t.sent(),[2,o]}})})}},jt=new RegExp("("+B.source+")"),Dt={parse:function(t,e){var n=this,r=t.args.match(jt);x(r,t.args+" not valid identifier"),this.variable=r[1],this.templates=[];var i=this.liquid.parser.parseStream(e);i.on("tag:endcapture",function(){return i.stop()}).on("template",function(t){return n.templates.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")}),i.start()},render:function(r){return h(this,void 0,void 0,function(){var e,n;return d(this,function(t){switch(t.label){case 0:return[4,this.liquid.renderer.renderTemplates(this.templates,r)];case 1:return e=t.sent(),(n=new A)[this.variable]=e,r.push(n),[2]}})})}},Ht={parse:function(t,e){var n=this;this.cond=t.args,this.cases=[],this.elseTemplates=[];var r=[],i=this.liquid.parser.parseStream(e).on("tag:when",function(t){n.cases.push({val:t.args,templates:r=[]})}).on("tag:else",function(){return r=n.elseTemplates}).on("tag:endcase",function(){return i.stop()}).on("template",function(t){return r.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t){for(var e=0;e<this.cases.length;e++){var n=this.cases[e];if(mt(n.val,t)===mt(this.cond,t))return this.liquid.renderer.renderTemplates(n.templates,t)}return this.liquid.renderer.renderTemplates(this.elseTemplates,t)}},zt={parse:function(t,e){var n=this.liquid.parser.parseStream(e);n.on("token",function(t){"endcomment"===t.name&&n.stop()}).on("end",function(){throw new Error("tag "+t.raw+" not closed")}),n.start()}},Ct=/[^\s,]+/,Yt=new RegExp("with\\s+("+Z.source+")"),$t={parse:function(t){var e=Ct.exec(t.args);e&&(this.staticValue=e[0]),(e=Z.exec(t.args))&&(this.value=e[0]),(e=Yt.exec(t.args))&&(this.with=e[1])},render:function(s,a){return h(this,void 0,void 0,function(){var e,n,r,i,o,u;return d(this,function(t){switch(t.label){case 0:return s.opts.dynamicPartials?rt.exec(this.value)?(n=this.value.slice(1,-1),[4,this.liquid.parseAndRender(n,s.getAll(),s.opts)]):[3,2]:[3,4];case 1:return e=t.sent(),[3,3];case 2:e=wt(this.value,s),t.label=3;case 3:return[3,5];case 4:e=this.staticValue,t.label=5;case 5:return x(e,"cannot include with empty filename"),r=s.blocks,i=s.blockMode,s.blocks={},s.blockMode=M.OUTPUT,this.with&&(a[e]=wt(this.with,s)),[4,this.liquid.getTemplate(e,s.opts)];case 6:return o=t.sent(),s.push(a),[4,this.liquid.renderer.renderTemplates(o,s)];case 7:return u=t.sent(),s.pop(a),s.blocks=r,s.blockMode=i,[2,u]}})})}},Gt={parse:function(t){var e=t.args.match(B);x(e,"illegal identifier "+t.args),this.variable=e[0]},render:function(t){var e=t.findContextFor(this.variable,function(t){return!(t instanceof A||t instanceof F)});return e||(e=new N,t.unshift(e)),"number"!=typeof e[this.variable]&&(e[this.variable]=0),--e[this.variable]}},Bt=new RegExp("^(?:("+Z.source+")\\s*:\\s*)?(.*)$"),Vt=new RegExp(Z.source,"g"),Wt={parse:function(t){var e=Bt.exec(t.args);x(e,"illegal tag: "+t.raw),this.group=e[1]||"";var n=e[2];for(this.candidates=[];e=Vt.exec(n);)this.candidates.push(e[0]);x(this.candidates.length,"empty candidates: "+t.raw)},render:function(t){var e="cycle:"+wt(this.group,t)+":"+this.candidates.join(","),n=t.groups,r=n[e];void 0===r&&(r=n[e]=0);var i=this.candidates[r];return r=(r+1)%this.candidates.length,n[e]=r,wt(i,t)}},Jt={parse:function(t,e){var n,r=this;this.branches=[],this.elseTemplates=[];var i=this.liquid.parser.parseStream(e).on("start",function(){return r.branches.push({cond:t.args,templates:n=[]})}).on("tag:elsif",function(t){r.branches.push({cond:t.args,templates:n=[]})}).on("tag:else",function(){return n=r.elseTemplates}).on("tag:endif",function(){return i.stop()}).on("template",function(t){return n.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t){for(var e=0,n=this.branches;e<n.length;e++){var r=n[e];if(bt(mt(r.cond,t)))return this.liquid.renderer.renderTemplates(r.templates,t)}return this.liquid.renderer.renderTemplates(this.elseTemplates,t)}},Xt={parse:function(t){var e=t.args.match(B);x(e,"illegal identifier "+t.args),this.variable=e[0]},render:function(t){var e=t.findContextFor(this.variable,function(t){return!(t instanceof A||t instanceof F)});e||(e=new I,t.unshift(e)),"number"!=typeof e[this.variable]&&(e[this.variable]=0);var n=e[this.variable];return e[this.variable]++,n}},Kt=/\S+/,Qt={parse:function(t,e){var n=Kt.exec(t.args);n&&(this.staticLayout=n[0]),(n=Z.exec(t.args))&&(this.layout=n[0]),this.tpls=this.liquid.parser.parse(e)},render:function(o,u){return h(this,void 0,void 0,function(){var e,n,r,i;return d(this,function(t){switch(t.label){case 0:return x(e=o.opts.dynamicPartials?wt(this.layout,o):this.staticLayout,"cannot apply layout with empty filename"),o.blockMode=M.STORE,[4,this.liquid.renderer.renderTemplates(this.tpls,o)];case 1:return n=t.sent(),void 0===o.blocks[""]&&(o.blocks[""]=n),[4,this.liquid.getTemplate(e,o.opts)];case 2:return r=t.sent(),o.push(u),o.blockMode=M.OUTPUT,[4,this.liquid.renderer.renderTemplates(r,o)];case 3:return i=t.sent(),o.pop(u),[2,i]}})})}},Zt={parse:function(t,e){var n=this,r=/\w+/.exec(t.args);this.block=r?r[0]:"",this.tpls=[];var i=this.liquid.parser.parseStream(e).on("tag:endblock",function(){return i.stop()}).on("template",function(t){return n.tpls.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(i){return h(this,void 0,void 0,function(){var e,n,r;return d(this,function(t){switch(t.label){case 0:return void 0===(e=i.blocks[this.block])?[3,1]:(r=e,[3,3]);case 1:return[4,this.liquid.renderer.renderTemplates(this.tpls,i)];case 2:r=t.sent(),t.label=3;case 3:return n=r,i.blockMode===M.STORE?(i.blocks[this.block]=n,[2,""]):[2,n]}})})}},te={parse:function(t,e){var n=this;this.tokens=[];var r=this.liquid.parser.parseStream(e);r.on("token",function(t){"endraw"===t.name?r.stop():n.tokens.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")}),r.start()},render:function(){return this.tokens.map(function(t){return t.raw}).join("")}},ee=new RegExp("^("+B.source+")\\s+in\\s+("+Z.source+")(?:\\s+"+tt.source+")*$"),ne={assign:It,for:Ut,capture:Dt,case:Ht,comment:zt,include:$t,decrement:Gt,increment:Xt,cycle:Wt,if:Jt,layout:Qt,block:Zt,raw:te,tablerow:{parse:function(t,e){var n,r=this,i=ee.exec(t.args);x(i,"illegal tag: "+t.raw),this.variable=i[1],this.collection=i[2],this.templates=[];var o=this.liquid.parser.parseStream(e).on("start",function(){return n=r.templates}).on("tag:endtablerow",function(){return o.stop()}).on("template",function(t){return n.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});o.start()},render:function(c,l){return h(this,void 0,void 0,function(){var e,n,r,o,i,u,s,a=this;return d(this,function(t){switch(t.label){case 0:return e=mt(this.collection,c)||[],n=l.offset||0,r=void 0===l.limit?e.length:l.limit,e=e.slice(n,n+r),o=l.cols||e.length,i=e.map(function(t){var e={};return e[a.variable]=t,e}),u=0,s="",[4,Nt(i,function(r,i){return h(a,void 0,void 0,function(){var e,n;return d(this,function(t){switch(t.label){case 0:return u=Math.floor(i/o)+1,1===(e=i%o+1)&&(1!==u&&(s+="</tr>"),s+='<tr class="row'+u+'">'),s+='<td class="col'+e+'">',c.push(r),n=s,[4,this.liquid.renderer.renderTemplates(this.templates,c)];case 1:return s=n+t.sent(),s+="</td>",c.pop(r),[2,s]}})})})];case 1:return t.sent(),0<u&&(s+="</tr>"),[2,s]}})})}},unless:{parse:function(t,e){var n,r=this;this.templates=[],this.elseTemplates=[];var i=this.liquid.parser.parseStream(e).on("start",function(){n=r.templates,r.cond=t.args}).on("tag:else",function(){return n=r.elseTemplates}).on("tag:endunless",function(){return i.stop()}).on("template",function(t){return n.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t){return Tt(mt(this.cond,t))?this.liquid.renderer.renderTemplates(this.templates,t):this.liquid.renderer.renderTemplates(this.elseTemplates,t)}},break:{render:function(){return h(this,void 0,void 0,function(){return d(this,function(t){throw new e("break")})})}},continue:{render:function(){return h(this,void 0,void 0,function(){return d(this,function(t){throw new e("continue")})})}}},re={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&#34;","'":"&#39;"},ie={"&amp;":"&","&lt;":"<","&gt;":">","&#34;":'"',"&#39;":"'"};function oe(t){return String(t).replace(/&|<|>|"|'/g,function(t){return re[t]})}var ue={escape:oe,escape_once:function(t){return oe(String(t).replace(/&(amp|lt|gt|#34|#39);/g,function(t){return ie[t]}))},newline_to_br:function(t){return t.replace(/\n/g,"<br />")},strip_html:function(t){return t.replace(/<script.*?<\/script>|<!--.*?-->|<style.*?<\/style>|<.*?>/g,"")}},se={append:function(t,e){return t+e},prepend:function(t,e){return e+t},capitalize:function(t){return String(t).charAt(0).toUpperCase()+t.slice(1)},lstrip:function(t){return String(t).replace(/^\s+/,"")},downcase:function(t){return t.toLowerCase()},upcase:function(t){return String(t).toUpperCase()},remove:function(t,e){return t.split(e).join("")},remove_first:function(t,e){return t.replace(e,"")},replace:function(t,e,n){return String(t).split(e).join(n)},replace_first:function(t,e,n){return String(t).replace(e,n)},rstrip:function(t){return String(t).replace(/\s+$/,"")},split:function(t,e){return String(t).split(e)},strip:function(t){return String(t).trim()},strip_newlines:function(t){return String(t).replace(/\n/g,"")},truncate:function(t,e,n){return void 0===e&&(e=50),void 0===n&&(n="..."),(t=String(t)).length<=e?t:t.substr(0,e-n.length)+n},truncatewords:function(t,e,n){void 0===e&&(e=15),void 0===n&&(n="...");var r=t.split(/\s+/),i=r.slice(0,e).join(" ");return r.length>=e&&(i+=n),i}},ae={abs:function(t){return Math.abs(t)},ceil:function(t){return Math.ceil(t)},divided_by:function(t,e){return t/e},floor:function(t){return Math.floor(t)},minus:le(function(t,e){return t-e}),modulo:le(function(t,e){return t%e}),round:function(t,e){void 0===e&&(e=0);var n=Math.pow(10,e);return Math.round(t*n)/n},plus:le(function(t,e){return Number(t)+Number(e)}),times:function(t,e){return t*e}};function ce(t){var e=String(t).split(".");return 1<e.length?e[1].length:0}function le(r){return function(t,e){var n=Math.max(ce(t),ce(e));return r(t,e).toFixed(n)}}var fe={url_decode:function(t){return t.split("+").map(decodeURIComponent).join(" ")},url_encode:function(t){return t.split(" ").map(encodeURIComponent).join("+")}},pe={join:function(t,e){return t.join(void 0===e?" ":e)},last:function(t){return g(t)},first:function(t){return t[0]},map:function(t,e){return t.map(function(t){return t[e]})},reverse:function(t){return t.reverse()},sort:function(t,e){return t.sort(e)},size:function(t){return t.length},concat:function(t,e){return Array.prototype.concat.call(t,e)},slice:function(t,e,n){return void 0===n&&(n=1),t.slice(e,e+n)},uniq:function(t){var e={};return(t||[]).filter(function(t){return!e.hasOwnProperty(String(t))&&(e[String(t)]=!0)})}},he=["January","February","March","April","May","June","July","August","September","October","November","December"],de=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ge=he.map(ye),ve=de.map(ye),me={1:"st",2:"nd",3:"rd",default:"th"};function ye(t){return t.slice(0,3)}var we={daysInMonth:function(t){return[31,we.isLeapYear(t)?29:28,31,30,31,30,31,31,30,31,30,31]},getDayOfYear:function(t){for(var e=0,n=0;n<t.getMonth();++n)e+=we.daysInMonth(t)[n];return e+t.getDate()},getWeekOfYear:function(t,e){var n=this.getDayOfYear(t)+(e-t.getDay()),r=7-new Date(t.getFullYear(),0,1).getDay()+e;return w(String(Math.floor((n-r)/7)+1),2,"0")},isLeapYear:function(t){var e=t.getFullYear();return!(0!=(3&e)||!(e%100||e%400==0&&e))},getSuffix:function(t){var e=t.getDate().toString(),n=parseInt(e.slice(-1));return me[n]||me.default},century:function(t){return parseInt(t.getFullYear().toString().substring(0,2),10)}},be={a:function(t){return ve[t.getDay()]},A:function(t){return de[t.getDay()]},b:function(t){return ge[t.getMonth()]},B:function(t){return he[t.getMonth()]},c:function(t){return t.toLocaleString()},C:function(t){return we.century(t)},d:function(t){return w(t.getDate(),2,"0")},e:function(t){return w(t.getDate(),2)},H:function(t){return w(t.getHours(),2,"0")},I:function(t){return w(String(t.getHours()%12||12),2,"0")},j:function(t){return w(we.getDayOfYear(t),3,"0")},k:function(t){return w(t.getHours(),2)},l:function(t){return w(String(t.getHours()%12||12),2)},L:function(t){return w(t.getMilliseconds(),3,"0")},m:function(t){return w(t.getMonth()+1,2,"0")},M:function(t){return w(t.getMinutes(),2,"0")},p:function(t){return t.getHours()<12?"AM":"PM"},P:function(t){return t.getHours()<12?"am":"pm"},q:function(t){return we.getSuffix(t)},s:function(t){return Math.round(t.valueOf()/1e3)},S:function(t){return w(t.getSeconds(),2,"0")},u:function(t){return t.getDay()||7},U:function(t){return we.getWeekOfYear(t,0)},w:function(t){return t.getDay()},W:function(t){return we.getWeekOfYear(t,1)},x:function(t){return t.toLocaleDateString()},X:function(t){return t.toLocaleTimeString()},y:function(t){return t.getFullYear().toString().substring(2,4)},Y:function(t){return t.getFullYear()},z:function(t){var e=t.getTimezoneOffset()/60*100;return(0<e?"-":"+")+w(String(Math.abs(e)),4,"0")},"%":function(){return"%"}};be.h=be.b,be.N=be.L;var Te=v({},ue,se,ae,fe,{date:function(t,e){var n,r=t;return"now"===t?r=new Date:l(t)&&(r=new Date(t)),(n=r)instanceof Date&&!isNaN(n.getTime())?function(t,e){for(var n="",r=e;;){var i=/%./g,o=i.exec(r);if(!o)return n+r;n+=r.slice(0,i.lastIndex-2),r=r.slice(i.lastIndex);var u=o[0].charAt(1),s=be[u];n+=s?s(t):"%"+u}}(r,e):t}},{default:function(t,e){return bt(t)?t:e}},pe);return function(){function e(t){void 0===t&&(t={});var n=this;this.cache={},this.options=R(S(t)),this.parser=new At(this),this.renderer=new ct,this.tokenizer=new at(this.options),p(ne,function(t,e){return n.registerTag(e,t)}),p(Te,function(t,e){return n.registerFilter(e,t)})}return e.prototype.parse=function(t,e){var n=this.tokenizer.tokenize(t,e);return this.parser.parse(n)},e.prototype.render=function(t,e,n){var r=v({},this.options,S(n)),i=new O(e,r);return this.renderer.renderTemplates(t,i)},e.prototype.parseAndRender=function(n,r,i){return h(this,void 0,void 0,function(){var e;return d(this,function(t){switch(t.label){case 0:return[4,this.parse(n)];case 1:return e=t.sent(),[2,this.render(e,r,i)]}})})},e.prototype.getTemplate=function(f,p){return h(this,void 0,void 0,function(){var e,n,r,i,o,u,s,a,c,l=this;return d(this,function(t){switch(t.label){case 0:e=S(p),n=e.root?e.root.concat(this.options.root):this.options.root,r=n.map(function(t){return U.resolve(t,f,l.options.extname)}),i=0,o=r,t.label=1;case 1:return i<o.length?(u=o[i],[4,U.exists(u)]):[3,5];case 2:return t.sent()?this.options.cache&&this.cache[u]?[2,this.cache[u]]:(a=this.parse,[4,U.readFile(u)]):[3,4];case 3:return s=a.apply(this,[t.sent(),u]),this.options.cache&&(this.cache[u]=s),[2,s];case 4:return i++,[3,1];case 5:throw(c=new Error("ENOENT")).message='ENOENT: Failed to lookup "'+f+'" in "'+n+'"',c.code="ENOENT",c}})})},e.prototype.renderFile=function(r,i,o){return h(this,void 0,void 0,function(){var e,n;return d(this,function(t){switch(t.label){case 0:return e=S(o),[4,this.getTemplate(r,e)];case 1:return n=t.sent(),[2,this.render(n,i,o)]}})})},e.prototype.evalValue=function(t,e){return new Mt(t,this.options.strict_filters).value(e)},e.prototype.registerFilter=function(t,e){return St.register(t,e)},e.prototype.registerTag=function(t,e){return qt.register(t,e)},e.prototype.plugin=function(t){return t.call(this,e)},e.prototype.express=function(){var i=this;return function(t,e,n){var r={root:this.root};i.renderFile(t,e,r).then(function(t){return n(null,t)},n)}},(e.default=e).isTruthy=bt,e.isFalsy=Tt,e.evalExp=mt,e.evalValue=wt,e.Types=P,e}()});
//# sourceMappingURL=liquid.min.js.map
import Scope from 'src/scope/scope';
export declare function evalExp(exp: string, scope: Scope): any;
export declare function parseExp(exp: string, scope: Scope): any;
export declare function evalExp(str: string, scope: Scope): any;
export declare function evalValue(str: string, scope: Scope): any;
export declare function isTruthy(val: any): boolean;
export declare function isFalsy(val: any): boolean;
import { NormalizedFullOptions } from '../liquid-options';
import BlockMode from './block-mode';
import IContext from './icontext';
export declare type Context = {
[key: string]: any;
liquid_method_missing?: (key: string) => any;
to_liquid?: () => any;
toLiquid?: () => any;
};
export default class Scope {
opts: NormalizedFullOptions;
contexts: Array<IContext>;
contexts: Array<Context>;
blocks: object;

@@ -13,3 +18,3 @@ groups: {

constructor(ctx?: object, opts?: NormalizedFullOptions);
getAll(): IContext;
getAll(): Context;
get(path: string): any;

@@ -20,5 +25,5 @@ set(path: string, v: any): void;

pop(ctx?: object): object | undefined;
findContextFor(key: string, filter?: ((conttext: object) => boolean)): IContext | null;
findContextFor(key: string, filter?: ((conttext: object) => boolean)): Context | null;
private readProperty;
propertyAccessSeq(str: string): string[];
}

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

export declare function isString(value: any): boolean;
export declare function isFunction(value: any): boolean;
export declare function isString(value: any): value is string;
export declare function isFunction(value: any): value is Function;
export declare function promisify<T1, T2>(fn: (arg1: T1, cb: (err: Error | null, result: T2) => void) => void): (arg1: T1) => Promise<T2>;

@@ -8,4 +8,4 @@ export declare function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, cb: (err: Error | null, result: T3) => void) => void): (arg1: T1, arg2: T2) => Promise<T3>;

export declare function isNil(value: any): boolean;
export declare function isArray(value: any): boolean;
export declare function isError(value: any): boolean;
export declare function isArray(value: any): value is any[];
export declare function isError(value: any): value is Error;
export declare function forOwn<T>(object: {

@@ -20,4 +20,4 @@ [key: string]: T;

export declare function last(arr: string): string;
export declare function isObject(value: any): boolean;
export declare function isObject(value: any): value is object;
export declare function range(start: number, stop?: number, step?: number): number[];
export declare function padStart(str: any, length: number, ch?: string): any;
{
"name": "liquidjs",
"version": "7.2.2",
"version": "7.3.0",
"description": "Liquid template engine by pure JavaScript: compatible to shopify, easy to extend.",

@@ -5,0 +5,0 @@ "main": "dist/liquid.common.js",

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

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc