{"size": 54813, "ext": "js", "max_stars_repo_path": "dist/liquid.browser.min.js", "max_stars_repo_name": "carrytravel/liquidjs", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "dist/liquid.browser.min.js", "max_issues_repo_name": "carrytravel/liquidjs", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "dist/liquid.browser.min.js", "max_forks_repo_name": "carrytravel/liquidjs", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 18271.0, "max_line_length": 54765, "alphanum_fraction": 0.6767920019}
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).liquidjs={})}(this,function(t){"use strict";var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function e(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var w=function(){return(w=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function s(s,o,a,u){return new(a=a||Promise)(function(t,e){function r(t){try{i(u.next(t))}catch(t){e(t)}}function n(t){try{i(u.throw(t))}catch(t){e(t)}}function i(e){e.done?t(e.value):new a(function(t){t(e.value)}).then(r,n)}i((u=u.apply(s,o||[])).next())})}function O(r,n){var i,s,o,t,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[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(;a;)try{if(i=1,s&&(o=2&e[0]?s.return:e[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,e[1])).done)return o;switch(s=0,o&&(e=[2&e[0],o.value]),e[0]){case 0:case 1:o=e;break;case 4:return a.label++,{value:e[1],done:!1};case 5:a.label++,s=e[1],e=[0];continue;case 7:e=a.ops.pop(),a.trys.pop();continue;default:if(!(o=0<(o=a.trys).length&&o[o.length-1])&&(6===e[0]||2===e[0])){a=0;continue}if(3===e[0]&&(!o||e[1]>o[0]&&e[1]<o[3])){a.label=e[1];break}if(6===e[0]&&a.label<o[1]){a.label=o[1],o=e;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(e);break}o[2]&&a.ops.pop(),a.trys.pop();continue}e=n.call(r,a)}catch(t){e=[6,t],s=0}finally{i=o=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}function q(t){var e="function"==typeof Symbol&&t[Symbol.iterator],r=0;return e?e.call(t):{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}function m(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,s=r.call(t),o=[];try{for(;(void 0===e||0<e--)&&!(n=s.next()).done;)o.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o}function b(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(m(arguments[e]));return t}var i=(r.prototype.valueOf=function(){},r.prototype.liquidMethodMissing=function(t){},r);function r(){}var o=Object.prototype.toString,a=String.prototype.toLowerCase;function u(t){return"[object String]"===o.call(t)}function c(t){return"function"==typeof t}function l(t){return f(t=h(t))?"":String(t)}function h(t){return t instanceof i?t.valueOf():t}function p(t){return"number"==typeof t}function f(t){return null==t}function v(t){return"[object Array]"===o.call(t)}function d(t,e){for(var r in t=t||{})if(t.hasOwnProperty(r)&&!1===e(t[r],r,t))break;return t}function g(t){return t[t.length-1]}function y(t){var e=typeof t;return null!==t&&("object"==e||"function"==e)}function T(t,e,r){void 0===r&&(r=1);for(var n=[],i=t;i<e;i+=r)n.push(i);return n}function k(t,e,r){return void 0===r&&(r=" "),x(t,e,r,function(t,e){return e+t})}function x(t,e,r,n){for(var i=e-(t=String(t)).length;0<i--;)t=n(t,r);return t}function S(t){return t}function R(t){return t.replace(/(\w?)([A-Z])/g,function(t,e,r){return(e?e+"_":"")+r.toLowerCase()})}function F(t,e){return null==t&&null==e?0:null==t?1:null==e?-1:(t=a.call(t))<(e=a.call(e))?-1:e<t?1:0}var E=function(t,e,r,n){this.key=t,this.value=e,this.next=r,this.prev=n},L=(M.prototype.write=function(t,e){if(this.cache[t])this.cache[t].value=e;else{var r=new E(t,e,this.head.next,this.head);this.head.next.prev=r,this.head.next=r,this.cache[t]=r,this.size++,this.ensureLimit()}},M.prototype.read=function(t){if(this.cache[t]){var e=this.cache[t].value;return this.remove(t),this.write(t,e),e}},M.prototype.remove=function(t){var e=this.cache[t];e.prev.next=e.next,e.next.prev=e.prev,delete this.cache[t],this.size--},M.prototype.clear=function(){this.head.next=this.tail,this.tail.prev=this.head,this.size=0,this.cache={}},M.prototype.ensureLimit=function(){this.size>this.limit&&this.remove(this.tail.prev.key)},M);function M(t,e){void 0===e&&(e=0),this.limit=t,this.size=e,this.cache={},this.head=new E("HEAD",null,null,null),this.tail=new E("TAIL",null,null,null),this.head.next=this.tail,this.tail.prev=this.head}var N={root:["."],cache:void 0,extname:"",dynamicPartials:!0,trimTagRight:!1,trimTagLeft:!1,trimOutputRight:!1,trimOutputLeft:!1,greedy:!0,tagDelimiterLeft:"{%",tagDelimiterRight:"%}",outputDelimiterLeft:"{{",outputDelimiterRight:"}}",strictFilters:!1,strictVariables:!1,globals:{}};function P(t){if((t=t||{}).hasOwnProperty("root")&&(t.root=D(t.root)),t.hasOwnProperty("cache")){var e=void 0;e="number"==typeof t.cache?0<t.cache?new L(t.cache):void 0:"object"==typeof t.cache?t.cache:t.cache?new L(1024):void 0,t.cache=e}return t}function D(t){return v(t)?t:u(t)?[t]:[]}var A=(_.prototype.getRegister=function(t,e){return void 0===e&&(e={}),this.registers[t]=this.registers[t]||e},_.prototype.setRegister=function(t,e){return this.registers[t]=e},_.prototype.saveRegister=function(){for(var e=this,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return t.map(function(t){return[t,e.getRegister(t)]})},_.prototype.restoreRegister=function(t){var i=this;return t.forEach(function(t){var e=m(t,2),r=e[0],n=e[1];return i.setRegister(r,n)})},_.prototype.getAll=function(){return b([this.globals,this.environments],this.scopes).reduce(function(t,e){return w(t,e)},{})},_.prototype.get=function(t){var e=this.findScope(t[0]);return this.getFromScope(e,t)},_.prototype.getFromScope=function(t,e){var r=this;return"string"==typeof e&&(e=e.split(".")),e.reduce(function(t,e){if(f(t=function(t,e){return f(t)?t:(t=function t(e){return e&&c(e.toLiquid)?t(e.toLiquid()):e}(t))instanceof i?c(t[e])?t[e]():t.hasOwnProperty(e)?t[e]:t.liquidMethodMissing(e):"size"===e?function(t){return v(t)||u(t)?t.length:t.size}(t):"first"===e?function(t){return v(t)?t[0]:t.first}(t):"last"===e?function(t){return v(t)?t[t.length-1]:t.last}(t):t[e]}(t,e))&&r.opts.strictVariables)throw new TypeError("undefined variable: "+e);return t},t)},_.prototype.push=function(t){return this.scopes.push(t)},_.prototype.pop=function(){return this.scopes.pop()},_.prototype.bottom=function(){return this.scopes[0]},_.prototype.findScope=function(t){for(var e=this.scopes.length-1;0<=e;e--){var r=this.scopes[e];if(t in r)return r}return t in this.environments?this.environments:this.globals},_);function _(t,e,r){void 0===t&&(t={}),void 0===e&&(e=N),void 0===r&&(r=!1),this.scopes=[{}],this.registers={},this.sync=r,this.opts=e,this.globals=e.globals,this.environments=t}var j,W,V=Object.freeze({resolve:function(t,e,i){return t.length&&"/"!==g(t)&&(t+="/"),function(t,e){var r=document.createElement("base");r.href=t;var n=document.getElementsByTagName("head")[0];n.insertBefore(r,n.firstChild);var i=document.createElement("a");i.href=e;var s=i.href;return n.removeChild(r),s}(t,e).replace(/^(\w+:\/\/[^/]+)(\/[^?]+)/,function(t,e,r){var n=r.split("/").pop();return/\.\w+$/.test(n)?t:e+r+i})},readFile:function(n){return s(this,void 0,void 0,function(){return O(this,function(t){return[2,new Promise(function(t,e){var r=new XMLHttpRequest;r.onload=function(){200<=r.status&&r.status<300?t(r.responseText):e(new Error(r.statusText))},r.onerror=function(){e(new Error("An error occurred whilst receiving the response."))},r.open("GET",n),r.send()})]})})},readFileSync:function(t){var e=new XMLHttpRequest;if(e.open("GET",t,!1),e.send(),e.status<200||300<=e.status)throw new Error(e.statusText);return e.responseText},exists:function(t){return s(this,void 0,void 0,function(){return O(this,function(t){return[2,!0]})})},existsSync:function(t){return!0}});function C(t){return!!(X(t)&j.Delimited)}function B(t){return X(t)===j.Operator}function H(t){return X(t)===j.HTML}function z(t){return X(t)===j.Output}function U(t){return X(t)===j.Tag}function Q(t){return X(t)===j.Quoted}function I(t){return X(t)===j.Literal}function J(t){return X(t)===j.Number}function Y(t){return X(t)===j.PropertyAccess}function G(t){return X(t)===j.Word}function $(t){return X(t)===j.Range}function X(t){return t?t.kind:-1}(W=j=j||{})[W.Number=1]="Number",W[W.Literal=2]="Literal",W[W.Tag=4]="Tag",W[W.Output=8]="Output",W[W.HTML=16]="HTML",W[W.Filter=32]="Filter",W[W.Hash=64]="Hash",W[W.PropertyAccess=128]="PropertyAccess",W[W.Word=256]="Word",W[W.Range=512]="Range",W[W.Quoted=1024]="Quoted",W[W.Operator=2048]="Operator",W[W.Delimited=12]="Delimited";var Z=Object.freeze({isDelimitedToken:C,isOperatorToken:B,isHTMLToken:H,isOutputToken:z,isTagToken:U,isQuotedToken:Q,isLiteralToken:I,isNumberToken:J,isPropertyAccessToken:Y,isWordToken:G,isRangeToken:$}),K=[0,0,0,0,0,0,0,0,0,20,4,4,4,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,2,8,0,0,0,0,8,0,0,0,64,0,65,0,0,33,33,33,33,33,33,33,33,33,33,0,0,2,2,2,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0],tt=4,et=16;function rt(t,e){if(t&&H(t))for(var r=e?tt:et;K[t.input.charCodeAt(t.end-1-t.trimRight)]&r;)t.trimRight++}function nt(t,e){if(t&&H(t)){for(var r=e?tt:et;K[t.input.charCodeAt(t.begin+t.trimLeft)]&r;)t.trimLeft++;"\n"===t.input.charAt(t.begin+t.trimLeft)&&t.trimLeft++}}K[160]=K[5760]=K[6158]=K[8192]=K[8193]=K[8194]=K[8195]=K[8196]=K[8197]=K[8198]=K[8199]=K[8200]=K[8201]=K[8202]=K[8232]=K[8233]=K[8239]=K[8287]=K[12288]=tt;var it=(st.prototype.getText=function(){return this.input.slice(this.begin,this.end)},st.prototype.getPosition=function(){for(var t=m([1,1],2),e=t[0],r=t[1],n=0;n<this.begin;n++)"\n"===this.input[n]?(e++,r=1):r++;return[e,r]},st.prototype.size=function(){return this.end-this.begin},st);function st(t,e,r,n,i){this.kind=t,this.input=e,this.begin=r,this.end=n,this.file=i}var ot,at=(e(ut,ot=it),ut);function ut(t,e){var r=ot.call(this,j.Number,t.input,t.begin,e?e.end:t.end,t.file)||this;return r.whole=t,r.decimal=e,r}var ct,lt=(e(ht,ct=it),ht.prototype.isNumber=function(t){void 0===t&&(t=!1);for(var e=t&&64&K[this.input.charCodeAt(this.begin)]?this.begin+1:this.begin;e<this.end;e++)if(!(32&K[this.input.charCodeAt(e)]))return!1;return!0},ht);function ht(t,e,r,n){var i=ct.call(this,j.Word,t,e,r,n)||this;return i.input=t,i.begin=e,i.end=r,i.file=n,i.content=i.getText(),i}var pt,ft=(e(dt,pt=i),dt.prototype.equals=function(t){return u(t)||v(t)?0===t.length:!!y(t)&&0===Object.keys(t).length},dt.prototype.gt=function(){return!1},dt.prototype.geq=function(){return!1},dt.prototype.lt=function(){return!1},dt.prototype.leq=function(){return!1},dt.prototype.valueOf=function(){return""},dt);function dt(){return null!==pt&&pt.apply(this,arguments)||this}var vt,gt=(e(yt,vt=ft),yt.prototype.equals=function(t){return!1===t||!!f(h(t))||(u(t)?/^\s*$/.test(t):vt.prototype.equals.call(this,t))},yt);function yt(){return null!==vt&&vt.apply(this,arguments)||this}var mt,wt=(e(bt,mt=i),bt.prototype.equals=function(t){return f(h(t))||t instanceof gt},bt.prototype.gt=function(){return!1},bt.prototype.geq=function(){return!1},bt.prototype.lt=function(){return!1},bt.prototype.leq=function(){return!1},bt.prototype.valueOf=function(){return null},bt);function bt(){return null!==mt&&mt.apply(this,arguments)||this}var Tt,kt={true:!0,false:!1,nil:new wt,null:new wt,empty:new ft,blank:new gt},xt=(e(St,Tt=it),St);function St(t,e,r,n){var i=Tt.call(this,j.Literal,t,e,r,n)||this;return i.input=t,i.begin=e,i.end=r,i.file=n,i.literal=i.getText(),i}var Ot,qt={"==":1,"!=":1,">":1,"<":1,">=":1,"<=":1,contains:1,and:0,or:0},Rt=(e(Ft,Ot=it),Ft.prototype.getPrecedence=function(){return qt[this.getText()]},Ft);function Ft(t,e,r,n){var i=Ot.call(this,j.Operator,t,e,r,n)||this;return i.input=t,i.begin=e,i.end=r,i.file=n,i.operator=i.getText(),i}var Et,Lt=(e(Mt,Et=it),Mt);function Mt(t,e,r){var n=Et.call(this,j.PropertyAccess,t.input,t.begin,r,t.file)||this;return n.variable=t,n.props=e,n}var Nt,Pt=(e(Dt,Nt=Error),Dt.prototype.update=function(){var t=this.originalError,e=function(t){var e=m(t.getPosition(),1)[0],r=t.input.split("\n"),n=Math.max(e-2,1),i=Math.min(e+3,r.length);return T(n,i+1).map(function(t){return(t===e?">> ":"   ")+k(String(t),String(i).length)+"| "+r[t-1]}).join("\n")}(this.token);this.message=function(t,e){e.file&&(t+=", file:"+e.file);var r=m(e.getPosition(),2),n=r[0],i=r[1];return t+=", line:"+n+", col:"+i}(t.message,this.token),this.stack=this.message+"\n"+e+"\n"+this.stack+"\nFrom "+t.stack},Dt);function Dt(t,e){var r=Nt.call(this,t.message)||this;return r.originalError=t,r.token=e,r}var At,_t=(e(jt,At=Pt),jt);function jt(t,e){var r=At.call(this,new Error(t),e)||this;return r.name="TokenizationError",At.prototype.update.call(r),r}var Wt,Vt=(e(Ct,Wt=Pt),Ct);function Ct(t,e){var r=Wt.call(this,t,e)||this;return r.name="ParseError",r.message=t.message,Wt.prototype.update.call(r),r}var Bt,Ht=(e(zt,Bt=Pt),zt.is=function(t){return t instanceof zt},zt);function zt(t,e){var r=Bt.call(this,t,e.token)||this;return r.name="RenderError",r.message=t.message,Bt.prototype.update.call(r),r}var Ut,Qt=(e(It,Ut=Error),It);function It(t){var e=Ut.call(this,t)||this;return e.name="AssertionError",e.message=t+"",e}function Jt(t,e){if(!t){var r=e?e():"expect "+t+" to be true";throw new Qt(r)}}var Yt,Gt=(e($t,Yt=it),$t);function $t(t,e,r,n,i,s){var o=Yt.call(this,j.Filter,r,n,i,s)||this;return o.name=t,o.args=e,o}var Xt,Zt=(e(Kt,Xt=it),Kt);function Kt(t,e,r,n,i,s){var o=Xt.call(this,j.Hash,t,e,r,s)||this;return o.input=t,o.begin=e,o.end=r,o.name=n,o.value=i,o.file=s,o}var te,ee=(e(re,te=it),re);function re(t,e,r,n){var i=te.call(this,j.Quoted,t,e,r,n)||this;return i.input=t,i.begin=e,i.end=r,i.file=n,i}var ne,ie=(e(se,ne=it),se.prototype.getContent=function(){return this.input.slice(this.begin+this.trimLeft,this.end-this.trimRight)},se);function se(t,e,r,n){var i=ne.call(this,j.HTML,t,e,r,n)||this;return i.input=t,i.begin=e,i.end=r,i.file=n,i.trimLeft=0,i.trimRight=0,i}var oe,ae=(e(ue,oe=it),ue);function ue(t,e,r,n,i,s,o,a){var u=oe.call(this,t,r,n,i,a)||this;u.trimLeft=!1,u.trimRight=!1,u.content=u.getText();var c="-"===e[0],l="-"===g(e);return u.content=e.slice(c?1:0,l?-1:e.length).trim(),u.trimLeft=c||s,u.trimRight=l||o,u}var ce,le=(e(he,ce=ae),he);function he(t,e,r,n,i){var s=this,o=n.trimTagLeft,a=n.trimTagRight,u=n.tagDelimiterLeft,c=n.tagDelimiterRight,l=t.slice(e+u.length,r-c.length);s=ce.call(this,j.Tag,l,t,e,r,o,a,i)||this;for(var h=0;1&K[s.content.charCodeAt(h)];)h++;if(s.name=s.content.slice(0,h),!s.name)throw new _t("illegal tag syntax",s);for(var p=h;K[s.content.charCodeAt(p)]&tt;)p++;return s.args=s.content.slice(p),s}var pe,fe=(e(de,pe=it),de);function de(t,e,r,n,i,s){var o=pe.call(this,j.Range,t,e,r,s)||this;return o.input=t,o.begin=e,o.end=r,o.lhs=n,o.rhs=i,o.file=s,o}var ve,ge=(e(ye,ve=ae),ye);function ye(t,e,r,n,i){var s=n.trimOutputLeft,o=n.trimOutputRight,a=n.outputDelimiterLeft,u=n.outputDelimiterRight,c=t.slice(e+a.length,r-u.length);return ve.call(this,j.Output,c,t,e,r,s,o,i)||this}var me={a:{n:{d:{end:!0,needBoundary:!0}}},o:{r:{end:!0,needBoundary:!0}},c:{o:{n:{t:{a:{i:{n:{s:{end:!0,needBoundary:!0}}}}}}}},"=":{"=":{end:!0}},"!":{"=":{end:!0}},">":{end:!0,"=":{end:!0}},"<":{end:!0,"=":{end:!0}}};var we=(be.prototype.readExpression=function(){var e,r,n;return O(this,function(t){switch(t.label){case 0:return(e=this.readValue())?[4,e]:[2];case 1:t.sent(),t.label=2;case 2:return this.p<this.N?(r=this.readOperator())&&(n=this.readValue())?[4,r]:[2]:[3,5];case 3:return t.sent(),[4,n];case 4:return t.sent(),[3,2];case 5:return[2]}})},be.prototype.readOperator=function(){this.skipBlank();var t=function(t,e,r){void 0===r&&(r=t.length);for(var n,i=me,s=e;i[t[s]]&&s<r;)(i=i[t[s++]]).end&&(n=i);return n?n.needBoundary&&1&t.charCodeAt(s)?-1:s:-1}(this.input,this.p,this.p+8);if(-1!==t)return new Rt(this.input,this.p,this.p=t,this.file)},be.prototype.readFilters=function(){for(var t=[];;){var e=this.readFilter();if(!e)return t;t.push(e)}},be.prototype.readFilter=function(){var t=this;if(this.skipBlank(),this.end())return null;Jt("|"===this.peek(),function(){return"unexpected token at "+t.snapshot()}),this.p++;var e=this.p,r=this.readWord();if(!r.size())return null;var n=[];if(this.skipBlank(),":"===this.peek())do{++this.p;var i=this.readFilterArg();for(i&&n.push(i);this.p<this.N&&","!==this.peek()&&"|"!==this.peek();)++this.p}while(","===this.peek());return new Gt(r.getText(),n,this.input,e,this.p,this.file)},be.prototype.readFilterArg=function(){var t=this.readValue();if(t){if(this.skipBlank(),":"!==this.peek())return t;++this.p;var e=this.readValue();return[t.getText(),e]}},be.prototype.readTopLevelTokens=function(t){void 0===t&&(t=N);for(var e=[];this.p<this.N;){var r=this.readTopLevelToken(t);e.push(r)}return function(t,e){e=w({greedy:!0},e);for(var r=!1,n=0;n<t.length;n++){var i=t[n];C(i)&&(!r&&i.trimLeft&&rt(t[n-1],e.greedy),U(i)&&("raw"===i.name?r=!0:"endraw"===i.name&&(r=!1)),!r&&i.trimRight&&nt(t[n+1],e.greedy))}}(e,t),e},be.prototype.readTopLevelToken=function(t){var e=t.tagDelimiterLeft,r=t.outputDelimiterLeft;return this.matchWord(e)?this.readTagToken(t):this.matchWord(r)?this.readOutputToken(t):this.readHTMLToken(t)},be.prototype.readHTMLToken=function(t){for(var e=this.p;this.p<this.N;){var r=t.tagDelimiterLeft,n=t.outputDelimiterLeft;if(this.matchWord(r))break;if(this.matchWord(n))break;++this.p}return new ie(this.input,e,this.p,this.file)},be.prototype.readTagToken=function(t){var e=this.file,r=this.input,n=t.tagDelimiterRight,i=this.p;return-1===this.readTo(n)&&this.mkError("tag "+this.snapshot(i)+" not closed",i),new le(r,i,this.p,t,e)},be.prototype.readOutputToken=function(t){var e=this.file,r=this.input,n=t.outputDelimiterRight,i=this.p;return-1===this.readTo(n)&&this.mkError("output "+this.snapshot(i)+" not closed",i),new ge(r,i,this.p,t,e)},be.prototype.mkError=function(t,e){throw new _t(t,new lt(this.input,e,this.N,this.file))},be.prototype.snapshot=function(t){return void 0===t&&(t=this.p),JSON.stringify(function(t,e){return t.length>e?t.substr(0,e-3)+"...":t}(this.input.slice(t),16))},be.prototype.readWord=function(){this.skipBlank();for(var t=this.p;1&this.peekType();)++this.p;return new lt(this.input,t,this.p,this.file)},be.prototype.readHashes=function(){for(var t=[];;){var e=this.readHash();if(!e)return t;t.push(e)}},be.prototype.readHash=function(){this.skipBlank(),","===this.peek()&&++this.p;var t,e=this.p,r=this.readWord();if(r.size())return this.skipBlank(),":"===this.peek()&&(++this.p,t=this.readValue()),new Zt(this.input,e,this.p,r,t,this.file)},be.prototype.remaining=function(){return this.input.slice(this.p)},be.prototype.advance=function(t){void 0===t&&(t=1),this.p+=t},be.prototype.end=function(){return this.p>=this.N},be.prototype.readTo=function(t){for(;this.p<this.N;)if(++this.p,this.reverseMatchWord(t))return this.p;return-1},be.prototype.readValue=function(){var t=this.readQuoted()||this.readRange();if(t)return t;var e=this.readWord();if(e.size()){for(var r=e.isNumber(!0),n=[];;)if("["===this.peek()){r=!1,this.p++;var i=this.readValue()||new lt(this.input,this.p,this.p,this.file);this.readTo("]"),n.push(i)}else{if("."!==this.peek()||"."===this.peek(1))break;if(this.p++,!(i=this.readWord()).size())break;i.isNumber()||(r=!1),n.push(i)}return!n.length&&kt.hasOwnProperty(e.content)?new xt(this.input,e.begin,e.end,this.file):r?new at(e,n[0]):new Lt(e,n,this.p)}},be.prototype.readRange=function(){this.skipBlank();var t=this.p;if("("===this.peek()){++this.p;var e=this.readValueOrThrow();this.p+=2;var r=this.readValueOrThrow();return++this.p,new fe(this.input,t,this.p,e,r,this.file)}},be.prototype.readValueOrThrow=function(){var t=this,e=this.readValue();return Jt(e,function(){return"unexpected token "+t.snapshot()+", value expected"}),e},be.prototype.readQuoted=function(){this.skipBlank();var t=this.p;if(8&this.peekType()){++this.p;for(var e=!1;this.p<this.N&&(++this.p,this.input[this.p-1]!==this.input[t]||e);)e?e=!1:"\\"===this.input[this.p-1]&&(e=!0);return new ee(this.input,t,this.p,this.file)}},be.prototype.readFileName=function(){for(var t=this.p;!(this.peekType()&tt)&&","!==this.peek()&&this.p<this.N;)this.p++;return new lt(this.input,t,this.p,this.file)},be.prototype.matchWord=function(t){for(var e=0;e<t.length;e++)if(t[e]!==this.input[this.p+e])return!1;return!0},be.prototype.reverseMatchWord=function(t){for(var e=0;e<t.length;e++)if(t[t.length-1-e]!==this.input[this.p-1-e])return!1;return!0},be.prototype.peekType=function(t){return void 0===t&&(t=0),K[this.input.charCodeAt(this.p+t)]},be.prototype.peek=function(t){return void 0===t&&(t=0),this.input[this.p+t]},be.prototype.skipBlank=function(){for(;this.peekType()&tt;)++this.p},be);function be(t,e){void 0===e&&(e=""),this.input=t,this.file=e,this.p=0,this.N=t.length}var Te=(ke.prototype.write=function(t){this.html+=t},ke);function ke(){this.html="",this.break=!1,this.continue=!1}var xe=(Se.prototype.renderTemplates=function(e,r,n){var i,s,o,a,u,c,l,h;return void 0===n&&(n=new Te),O(this,function(t){switch(t.label){case 0:t.trys.push([0,7,8,9]),i=q(e),s=i.next(),t.label=1;case 1:if(s.done)return[3,6];o=s.value,t.label=2;case 2:return t.trys.push([2,4,,5]),[4,o.render(r,n)];case 3:return(a=t.sent())&&n.write(a),n.break||n.continue?[3,6]:[3,5];case 4:throw u=t.sent(),Ht.is(u)?u:new Ht(u,o);case 5:return s=i.next(),[3,1];case 6:return[3,9];case 7:return c=t.sent(),l={error:c},[3,9];case 8:try{s&&!s.done&&(h=i.return)&&h.call(i)}finally{if(l)throw l.error}return[7];case 9:return[2,n.html]}})},Se);function Se(){}var Oe=(qe.prototype.on=function(t,e){return this.handlers[t]=e,this},qe.prototype.trigger=function(t,e){var r=this.handlers[t];return!!r&&(r(e),!0)},qe.prototype.start=function(){var t;for(this.trigger("start");!this.stopRequested&&(t=this.tokens.shift());)if(!(this.trigger("token",t)||U(t)&&this.trigger("tag:"+t.name,t))){var e=this.parseToken(t,this.tokens);this.trigger("template",e)}return this.stopRequested||this.trigger("end"),this},qe.prototype.stop=function(){return this.stopRequested=!0,this},qe);function qe(t,e){this.handlers={},this.stopRequested=!1,this.tokens=t,this.parseToken=e}function Re(t){this.token=t}var Fe=/[\da-fA-F]/,Ee=/[0-7]/,Le={b:"\b",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v"};function Me(t){var e=t.charCodeAt(0);return 97<=e?e-87:65<=e?e-55:e-48}function Ne(t){return t&&c(t.equals)}function Pe(t){return!De(t)}function De(t){return!1===t||null==t}var Ae={"==":function(t,e){return Ne(t)?t.equals(e):Ne(e)?e.equals(t):t===e},"!=":function(t,e){return Ne(t)?!t.equals(e):Ne(e)?!e.equals(t):t!==e},">":function(t,e){return Ne(t)?t.gt(e):Ne(e)?e.lt(t):e<t},"<":function(t,e){return Ne(t)?t.lt(e):Ne(e)?e.gt(t):t<e},">=":function(t,e){return Ne(t)?t.geq(e):Ne(e)?e.leq(t):e<=t},"<=":function(t,e){return Ne(t)?t.leq(e):Ne(e)?e.geq(t):t<=e},contains:function(t,e){return!(!t||!c(t.indexOf))&&-1<t.indexOf(e)},and:function(t,e){return Pe(t)&&Pe(e)},or:function(t,e){return Pe(t)||Pe(e)}},_e=(je.prototype.evaluate=function(t){var e,r,n,i;try{for(var s=q(this.postfix),o=s.next();!o.done;o=s.next()){var a=o.value;if(B(a)){var u=this.operands.pop(),c=this.operands.pop(),l=(n=c,i=u,(0,Ae[a.operator])(n,i));this.operands.push(l)}else this.operands.push(We(a,t))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return this.operands[0]},je.prototype.value=function(e){return O(this,function(t){return[2,h(this.evaluate(e))]})},je);function je(t){this.operands=[];var e=new we(t);this.postfix=function(e){var r,n,i,s,o,a,u;return O(this,function(t){switch(t.label){case 0:r=[],t.label=1;case 1:t.trys.push([1,10,11,12]),n=q(e),i=n.next(),t.label=2;case 2:if(i.done)return[3,9];if(!B(s=i.value))return[3,6];t.label=3;case 3:return r.length&&r[r.length-1].getPrecedence()>s.getPrecedence()?[4,r.pop()]:[3,5];case 4:return t.sent(),[3,3];case 5:return r.push(s),[3,8];case 6:return[4,s];case 7:t.sent(),t.label=8;case 8:return i=n.next(),[3,2];case 9:return[3,12];case 10:return o=t.sent(),a={error:o},[3,12];case 11:try{i&&!i.done&&(u=n.return)&&u.call(n)}finally{if(a)throw a.error}return[7];case 12:return r.length?[4,r.pop()]:[3,14];case 13:return t.sent(),[3,12];case 14:return[2]}})}(e.readExpression())}function We(t,e){if(Jt(e,function(){return"unable to evaluate: context not defined"}),Y(t)){var r=t.variable.getText(),n=t.props.map(function(t){return We(t,e)});return e.get(b([r],n))}return $(t)?function(t,e){var r=We(t.lhs,e),n=We(t.rhs,e);return T(+r,+n+1)}(t,e):I(t)?function(t){return kt[t.literal]}(t):J(t)?function(t){var e=t.whole.content+"."+(t.decimal?t.decimal.content:"");return Number(e)}(t):G(t)?t.getText():Q(t)?Ve(t):void 0}function Ve(t){return function(t){for(var e="",r=1;r<t.length-1;r++)if("\\"===t[r])if(void 0!==Le[t[r+1]])e+=Le[t[++r]];else if("u"===t[r+1]){for(var n=0,i=r+2;i<=r+5&&Fe.test(t[i]);)n=16*n+Me(t[i++]);r=i-1,e+=String.fromCharCode(n)}else if(Ee.test(t[r+1])){for(i=r+1,n=0;i<=r+3&&Ee.test(t[i]);)n=8*n+Me(t[i++]);r=i-1,e+=String.fromCharCode(n)}else e+=t[++r];else e+=t[r];return e}(t.getText())}var Ce=(Be.prototype.render=function(e){var r,n,i,s,o,a;return O(this,function(t){r={};try{for(n=q(Object.keys(this.hash)),i=n.next();!i.done;i=n.next())s=i.value,r[s]=We(this.hash[s],e)}catch(t){o={error:t}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(o)throw o.error}}return[2,r]})},Be);function Be(t){var e,r;this.hash={};var n=new we(t);try{for(var i=q(n.readHashes()),s=i.next();!s.done;s=i.next()){var o=s.value;this.hash[o.name.content]=o.value}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}}var He,ze=(e(Ue,He=Re),Ue.prototype.render=function(e,r){var n,i;return O(this,function(t){switch(t.label){case 0:return[4,new Ce(this.token.args).render(e)];case 1:return n=t.sent(),c((i=this.impl).render)?[4,i.render(e,r,n)]:[3,3];case 2:return[2,t.sent()];case 3:return[2]}})},Ue.impls={},Ue);function Ue(t,e,r){var n=He.call(this,t)||this;n.name=t.name;var i=r.tags.get(t.name);return n.impl=Object.create(i),n.impl.liquid=r,n.impl.parse&&n.impl.parse(t,e),n}var Qe=(Ie.prototype.render=function(e,r){var n,i,s,o,a,u,c,l,h,p,f,d;return O(this,function(t){switch(t.label){case 0:n=[],t.label=1;case 1:t.trys.push([1,8,9,10]),i=q(this.args),s=i.next(),t.label=2;case 2:return s.done?[3,7]:function(t){return v(t)}(o=s.value)?(u=(a=n).push,c=[o[0]],[4,We(o[1],r)]):[3,4];case 3:return u.apply(a,[c.concat([t.sent()])]),[3,6];case 4:return h=(l=n).push,[4,We(o,r)];case 5:h.apply(l,[t.sent()]),t.label=6;case 6:return s=i.next(),[3,2];case 7:return[3,10];case 8:return p=t.sent(),f={error:p},[3,10];case 9:try{s&&!s.done&&(d=i.return)&&d.call(i)}finally{if(f)throw f.error}return[7];case 10:return[4,this.impl.apply({context:r},b([e],n))];case 11:return[2,t.sent()]}})},Ie);function Ie(t,e,r){this.name=t,this.impl=e||S,this.args=r}var Je=(Ye.prototype.value=function(e){var r,n,i,s,o,a;return O(this,function(t){switch(t.label){case 0:return[4,We(this.initial,e)];case 1:r=t.sent(),t.label=2;case 2:t.trys.push([2,7,8,9]),n=q(this.filters),i=n.next(),t.label=3;case 3:return i.done?[3,6]:[4,i.value.render(r,e)];case 4:r=t.sent(),t.label=5;case 5:return i=n.next(),[3,3];case 6:return[3,9];case 7:return s=t.sent(),o={error:s},[3,9];case 8:try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(o)throw o.error}return[7];case 9:return[2,r]}})},Ye);function Ye(t,e){var n=this;this.filterMap=e,this.filters=[];var r=new we(t);this.initial=r.readValue(),this.filters=r.readFilters().map(function(t){var e=t.name,r=t.args;return new Qe(e,n.filterMap.get(e),r)})}var Ge,$e=(e(Xe,Ge=Re),Xe.prototype.render=function(e,r){var n;return O(this,function(t){switch(t.label){case 0:return[4,this.value.value(e)];case 1:return n=t.sent(),r.write(l(h(n))),[2]}})},Xe);function Xe(t,e){var r=Ge.call(this,t)||this;return r.value=new Je(t.content,e),r}var Ze,Ke=(e(tr,Ze=Re),tr.prototype.render=function(t,e){return O(this,function(t){return e.write(this.str),[2]})},tr);function tr(t){var e=Ze.call(this,t)||this;return e.str=t.getContent(),e}var er=(rr.prototype.parse=function(t){for(var e,r=[];e=t.shift();)r.push(this.parseToken(e,t));return r},rr.prototype.parseToken=function(e,t){try{return U(e)?new ze(e,t,this.liquid):z(e)?new $e(e,this.liquid.filters):new Ke(e)}catch(t){throw new Vt(t,e)}},rr.prototype.parseStream=function(t){var r=this;return new Oe(t,function(t,e){return r.parseToken(t,e)})},rr);function rr(t){this.liquid=t}var nr={parse:function(t){var e=new we(t.args);this.key=e.readWord().content,e.skipBlank(),Jt("="===e.peek(),function(){return"illegal token "+t.getText()}),e.advance(),this.value=e.remaining()},render:function(e){var r,n;return O(this,function(t){switch(t.label){case 0:return r=e.bottom(),n=this.key,[4,this.liquid._evalValue(this.value,e)];case 1:return r[n]=t.sent(),[2]}})}};function ir(e){var t={then:function(t){return t(e)},catch:function(){return t}};return t}function sr(r){var n={then:function(t,e){return e?e(r):n},catch:function(t){return t(r)}};return n}function or(t){return t&&c(t.then)}function ar(n){return or(n)?n:function(t){return t&&c(t.next)&&c(t.throw)&&c(t.return)}(n)?function r(t){var e;try{e=n.next(t)}catch(t){return sr(t)}if(e.done)return ir(e.value);return ar(e.value).then(r,function(t){var e;try{e=n.throw(t)}catch(t){return sr(t)}return e.done?ir(e.value):r(e.value)})}():ir(n)}function ur(t){var e;return ar(t).then(function(t){return ir(e=t)}).catch(function(t){throw t}),e}function cr(e){return O(this,function(t){switch(t.label){case 0:return or(e)?[4,e]:[3,2];case 1:e=t.sent(),t.label=2;case 2:return v(e)?[2,e]:u(e)&&0<e.length?[2,[e]]:y(e)?[2,Object.keys(e).map(function(t){return[t,e[t]]})]:[2,[]]}})}function lr(t){return v(t)?t:[t]}var hr,pr=(e(fr,hr=i),fr.prototype.next=function(){this.i++},fr.prototype.index0=function(){return this.i},fr.prototype.index=function(){return this.i+1},fr.prototype.first=function(){return 0===this.i},fr.prototype.last=function(){return this.i===this.length-1},fr.prototype.rindex=function(){return this.length-this.i},fr.prototype.rindex0=function(){return this.length-this.i-1},fr.prototype.valueOf=function(){return JSON.stringify(this)},fr);function fr(t){var e=hr.call(this)||this;return e.i=0,e.length=t,e}var dr,vr,gr={type:"block",parse:function(t,e){var r,n=this,i=new we(t.args),s=i.readWord(),o=i.readWord(),a=i.readValue();Jt(s.size()&&"in"===o.content&&a,function(){return"illegal tag: "+t.getText()}),this.variable=s.content,this.collection=a,this.hash=new Ce(i.remaining()),this.templates=[],this.elseTemplates=[];var u=this.liquid.parser.parseStream(e).on("start",function(){return r=n.templates}).on("tag:else",function(){return r=n.elseTemplates}).on("tag:endfor",function(){return u.stop()}).on("template",function(t){return r.push(t)}).on("end",function(){throw new Error("tag "+t.getText()+" not closed")});u.start()},render:function(e,r){var n,i,s,o,a,u,c,l,h,p,f,d;return O(this,function(t){switch(t.label){case 0:return n=this.liquid.renderer,[4,cr(We(this.collection,e))];case 1:return(i=t.sent()).length?[3,3]:[4,n.renderTemplates(this.elseTemplates,e,r)];case 2:return t.sent(),[2];case 3:return[4,this.hash.render(e)];case 4:s=t.sent(),o=s.offset||0,a=void 0===s.limit?i.length:s.limit,i=i.slice(o,o+a),"reversed"in s&&i.reverse(),u={forloop:new pr(i.length)},e.push(u),t.label=5;case 5:t.trys.push([5,10,11,12]),c=q(i),l=c.next(),t.label=6;case 6:return l.done?[3,9]:(h=l.value,u[this.variable]=h,[4,n.renderTemplates(this.templates,e,r)]);case 7:if(t.sent(),r.break)return r.break=!1,[3,9];r.continue=!1,u.forloop.next(),t.label=8;case 8:return l=c.next(),[3,6];case 9:return[3,12];case 10:return p=t.sent(),f={error:p},[3,12];case 11:try{l&&!l.done&&(d=c.return)&&d.call(c)}finally{if(f)throw f.error}return[7];case 12:return e.pop(),[2]}})}},yr={parse:function(t,e){var r=this,n=new we(t.args);this.variable=n.readWord().content,Jt(this.variable,function(){return t.args+" not valid identifier"}),this.templates=[];var i=this.liquid.parser.parseStream(e);i.on("tag:endcapture",function(){return i.stop()}).on("template",function(t){return r.templates.push(t)}).on("end",function(){throw new Error("tag "+t.getText()+" not closed")}),i.start()},render:function(e){var r;return O(this,function(t){switch(t.label){case 0:return[4,this.liquid.renderer.renderTemplates(this.templates,e)];case 1:return r=t.sent(),e.bottom()[this.variable]=r,[2]}})}},mr={parse:function(t,e){var r=this;this.cond=t.args,this.cases=[],this.elseTemplates=[];var n=[],i=this.liquid.parser.parseStream(e).on("tag:when",function(t){r.cases.push({val:t.args,templates:n=[]})}).on("tag:else",function(){return n=r.elseTemplates}).on("tag:endcase",function(){return i.stop()}).on("template",function(t){return n.push(t)}).on("end",function(){throw new Error("tag "+t.getText()+" not closed")});i.start()},render:function(e,r){var n,i,s,o;return O(this,function(t){switch(t.label){case 0:return n=this.liquid.renderer,[4,new _e(this.cond).value(e)];case 1:i=t.sent(),s=0,t.label=2;case 2:return s<this.cases.length?(o=this.cases[s],[4,new _e(o.val).value(e)]):[3,6];case 3:return t.sent()!==i?[3,5]:[4,n.renderTemplates(o.templates,e,r)];case 4:return t.sent(),[2];case 5:return s++,[3,2];case 6:return[4,n.renderTemplates(this.elseTemplates,e,r)];case 7:return t.sent(),[2]}})}},wr={parse:function(t,e){var r=this.liquid.parser.parseStream(e);r.on("token",function(t){"endcomment"===t.name&&r.stop()}).on("end",function(){throw new Error("tag "+t.getText()+" not closed")}),r.start()}};(vr=dr=dr||{})[vr.OUTPUT=0]="OUTPUT",vr[vr.STORE=1]="STORE";var br,Tr=dr,kr={parse:function(t){var e=t.args,r=new we(e);this.file=this.liquid.options.dynamicPartials?r.readValue():r.readFileName(),Jt(this.file,function(){return'illegal argument "'+t.args+'"'});var n=r.p;"with"===r.readWord().content?(r.skipBlank(),":"!==r.peek()?this.withVar=r.readValue():r.p=n):r.p=n,this.hash=new Ce(r.remaining())},render:function(e,r){var n,i,s,o,a,u,c,l,h,p,f,d;return O(this,function(t){switch(t.label){case 0:return i=(n=this).liquid,s=n.hash,o=n.withVar,a=n.file,u=i.renderer,e.opts.dynamicPartials?Q(a)?[4,u.renderTemplates(i.parse(Ve(a)),e)]:[3,2]:[3,5];case 1:return h=t.sent(),[3,4];case 2:return[4,We(a,e)];case 3:h=t.sent(),t.label=4;case 4:return l=h,[3,6];case 5:l=a.getText(),t.label=6;case 6:return Jt(c=l,function(){return'illegal filename "'+a.getText()+'":"'+c+'"'}),p=e.saveRegister("blocks","blockMode"),e.setRegister("blocks",{}),e.setRegister("blockMode",Tr.OUTPUT),[4,s.render(e)];case 7:return f=t.sent(),o&&(f[c]=We(o,e)),[4,i._parseFile(c,e.opts,e.sync)];case 8:return d=t.sent(),e.push(f),[4,u.renderTemplates(d,e,r)];case 9:return t.sent(),e.pop(),e.restoreRegister(p),[2]}})}},xr={parse:function(t){var e=t.args,r=new we(e);for(this.file=this.liquid.options.dynamicPartials?r.readValue():r.readFileName(),Jt(this.file,function(){return'illegal argument "'+t.args+'"'});!r.end();){r.skipBlank();var n=r.p,i=r.readWord();if(("with"===i.content||"for"===i.content)&&(r.skipBlank(),":"!==r.peek())){var s=r.readValue();if(s){var o=r.p,a=void 0;"as"===r.readWord().content?a=r.readWord():r.p=o,this[i.content]={value:s,alias:a&&a.content},r.skipBlank(),","===r.peek()&&r.advance();continue}}r.p=n;break}this.hash=new Ce(r.remaining())},render:function(e,r){var n,i,s,o,a,u,c,l,h,p,f,d,v,g,y,m,w,b,T,k,x,S;return O(this,function(t){switch(t.label){case 0:return i=(n=this).liquid,s=n.file,o=n.hash,a=i.renderer,e.opts.dynamicPartials?Q(s)?[4,a.renderTemplates(i.parse(Ve(s)),e)]:[3,2]:[3,4];case 1:return l=t.sent(),[3,3];case 2:l=We(s,e),t.label=3;case 3:return c=l,[3,5];case 4:c=s.getText(),t.label=5;case 5:return Jt(u=c,function(){return'illegal filename "'+s.getText()+'":"'+u+'"'}),h=new A({},e.opts,e.sync),[4,o.render(e)];case 6:return p=t.sent(),this.with&&(f=this.with,v=f.value,g=f.alias,p[g||u]=We(v,e)),h.push(p),this.for?(d=this.for,v=d.value,g=d.alias,[4,cr(y=We(v,e))]):[3,17];case 7:y=t.sent(),p.forloop=new pr(y.length),t.label=8;case 8:t.trys.push([8,14,15,16]),m=q(y),w=m.next(),t.label=9;case 9:return w.done?[3,13]:(b=w.value,p[g]=b,[4,i._parseFile(u,h.opts,h.sync)]);case 10:return k=t.sent(),[4,a.renderTemplates(k,h,r)];case 11:t.sent(),p.forloop.next(),t.label=12;case 12:return w=m.next(),[3,9];case 13:return[3,16];case 14:return T=t.sent(),x={error:T},[3,16];case 15:try{w&&!w.done&&(S=m.return)&&S.call(m)}finally{if(x)throw x.error}return[7];case 16:return[3,20];case 17:return[4,i._parseFile(u,h.opts,h.sync)];case 18:return k=t.sent(),[4,a.renderTemplates(k,h,r)];case 19:t.sent(),t.label=20;case 20:return[2]}})}},Sr={parse:function(t){var e=new we(t.args);this.variable=e.readWord().content},render:function(t,e){var r=t.environments;p(r[this.variable])||(r[this.variable]=0),e.write(l(--r[this.variable]))}},Or={parse:function(t){var e=new we(t.args),r=e.readValue();for(e.skipBlank(),this.candidates=[],r&&(":"===e.peek()?(this.group=r,e.advance()):this.candidates.push(r));!e.end();){var n=e.readValue();n&&this.candidates.push(n),e.readTo(",")}Jt(this.candidates.length,function(){return"empty candidates: "+t.getText()})},render:function(t,e){var r="cycle:"+We(this.group,t)+":"+this.candidates.join(","),n=t.getRegister("cycle"),i=n[r];void 0===i&&(i=n[r]=0);var s=this.candidates[i];i=(i+1)%this.candidates.length,n[r]=i;var o=We(s,t);e.write(o)}},qr={parse:function(t,e){var r,n=this;this.branches=[],this.elseTemplates=[];var i=this.liquid.parser.parseStream(e).on("start",function(){return n.branches.push({cond:t.args,templates:r=[]})}).on("tag:elsif",function(t){n.branches.push({cond:t.args,templates:r=[]})}).on("tag:else",function(){return r=n.elseTemplates}).on("tag:endif",function(){return i.stop()}).on("template",function(t){return r.push(t)}).on("end",function(){throw new Error("tag "+t.getText()+" not closed")});i.start()},render:function(e,r){var n,i,s,o,a,u,c;return O(this,function(t){switch(t.label){case 0:n=this.liquid.renderer,t.label=1;case 1:t.trys.push([1,7,8,9]),i=q(this.branches),s=i.next(),t.label=2;case 2:return s.done?[3,6]:(o=s.value,[4,new _e(o.cond).value(e)]);case 3:return Pe(t.sent())?[4,n.renderTemplates(o.templates,e,r)]:[3,5];case 4:return t.sent(),[2];case 5:return s=i.next(),[3,2];case 6:return[3,9];case 7:return a=t.sent(),u={error:a},[3,9];case 8:try{s&&!s.done&&(c=i.return)&&c.call(i)}finally{if(u)throw u.error}return[7];case 9:return[4,n.renderTemplates(this.elseTemplates,e,r)];case 10:return t.sent(),[2]}})}},Rr={parse:function(t){var e=new we(t.args);this.variable=e.readWord().content},render:function(t,e){var r=t.environments;p(r[this.variable])||(r[this.variable]=0);var n=r[this.variable];r[this.variable]++,e.write(l(n))}},Fr={parse:function(t,e){var r=new we(t.args),n=this.liquid.options.dynamicPartials?r.readValue():r.readFileName();Jt(n,function(){return'illegal argument "'+t.args+'"'}),this.file=n,this.hash=new Ce(r.remaining()),this.tpls=this.liquid.parser.parse(e)},render:function(e,r){var n,i,s,o,a,u,c,l,h,p,f,d,v,g;return O(this,function(t){switch(t.label){case 0:return i=(n=this).liquid,s=n.hash,o=n.file,a=i.renderer,e.opts.dynamicPartials?Q(o)?[4,a.renderTemplates(i.parse(Ve(o)),e)]:[3,2]:[3,4];case 1:return l=t.sent(),[3,3];case 2:l=We(this.file,e),t.label=3;case 3:return c=l,[3,5];case 4:c=o.getText(),t.label=5;case 5:return Jt(u=c,function(){return'illegal filename "'+o.getText()+'":"'+u+'"'}),e.setRegister("blockMode",Tr.STORE),h=e.getRegister("blocks"),[4,a.renderTemplates(this.tpls,e)];case 6:return p=t.sent(),void 0===h[""]&&(h[""]=p),[4,i._parseFile(u,e.opts,e.sync)];case 7:return f=t.sent(),v=(d=e).push,[4,s.render(e)];case 8:return v.apply(d,[t.sent()]),e.setRegister("blockMode",Tr.OUTPUT),[4,a.renderTemplates(f,e)];case 9:return g=t.sent(),e.pop(),r.write(g),[2]}})}},Er={parse:function(t,e){var r=this,n=/\w+/.exec(t.args);this.block=n?n[0]:"",this.tpls=[];var i=this.liquid.parser.parseStream(e).on("tag:endblock",function(){return i.stop()}).on("template",function(t){return r.tpls.push(t)}).on("end",function(){throw new Error("tag "+t.getText()+" not closed")});i.start()},render:function(e,r){var n,i,s,o,a;return O(this,function(t){switch(t.label){case 0:return n=e.getRegister("blocks"),i=n[this.block],s=this.liquid.renderer,void 0===i?[3,1]:(a=i,[3,3]);case 1:return[4,s.renderTemplates(this.tpls,e)];case 2:a=t.sent(),t.label=3;case 3:return o=a,e.getRegister("blockMode",Tr.OUTPUT)===Tr.STORE?(n[this.block]=o,[2]):(r.write(o),[2])}})}},Lr={parse:function(t,e){var r=this;this.tokens=[];var n=this.liquid.parser.parseStream(e);n.on("token",function(t){"endraw"===t.name?n.stop():r.tokens.push(t)}).on("end",function(){throw new Error("tag "+t.getText()+" not closed")}),n.start()},render:function(){return this.tokens.map(function(t){return t.getText()}).join("")}},Mr=(e(Nr,br=pr),Nr.prototype.row=function(){return Math.floor(this.i/this.cols)+1},Nr.prototype.col0=function(){return this.i%this.cols},Nr.prototype.col=function(){return this.col0()+1},Nr.prototype.col_first=function(){return 0===this.col0()},Nr.prototype.col_last=function(){return this.col()===this.cols},Nr);function Nr(t,e){var r=br.call(this,t)||this;return r.length=t,r.cols=e,r}var Pr={assign:nr,for:gr,capture:yr,case:mr,comment:wr,include:kr,render:xr,decrement:Sr,increment:Rr,cycle:Or,if:qr,layout:Fr,block:Er,raw:Lr,tablerow:{parse:function(t,e){var r=this,n=new we(t.args);this.variable=n.readWord(),n.skipBlank();var i,s=n.readWord();Jt(s&&"in"===s.content,function(){return"illegal tag: "+t.getText()}),this.collection=n.readValue(),this.hash=new Ce(n.remaining()),this.templates=[];var o=this.liquid.parser.parseStream(e).on("start",function(){return i=r.templates}).on("tag:endtablerow",function(){return o.stop()}).on("template",function(t){return i.push(t)}).on("end",function(){throw new Error("tag "+t.getText()+" not closed")});o.start()},render:function(e,r){var n,i,s,o,a,u,c,l,h;return O(this,function(t){switch(t.label){case 0:return[4,cr(We(this.collection,e))];case 1:return n=t.sent(),[4,this.hash.render(e)];case 2:i=t.sent(),s=i.offset||0,o=void 0===i.limit?n.length:i.limit,n=n.slice(s,s+o),a=i.cols||n.length,u=this.liquid.renderer,c=new Mr(n.length,a),l={tablerowloop:c},e.push(l),h=0,t.label=3;case 3:return h<n.length?(l[this.variable.content]=n[h],0===c.col0()&&(1!==c.row()&&r.write("</tr>"),r.write('<tr class="row'+c.row()+'">')),r.write('<td class="col'+c.col()+'">'),[4,u.renderTemplates(this.templates,e,r)]):[3,6];case 4:t.sent(),r.write("</td>"),t.label=5;case 5:return h++,c.next(),[3,3];case 6:return n.length&&r.write("</tr>"),e.pop(),[2]}})}},unless:{parse:function(t,e){var r,n=this;this.templates=[],this.elseTemplates=[];var i=this.liquid.parser.parseStream(e).on("start",function(){r=n.templates,n.cond=t.args}).on("tag:else",function(){return r=n.elseTemplates}).on("tag:endunless",function(){return i.stop()}).on("template",function(t){return r.push(t)}).on("end",function(){throw new Error("tag "+t.getText()+" not closed")});i.start()},render:function(e,r){var n;return O(this,function(t){switch(t.label){case 0:return n=this.liquid.renderer,[4,new _e(this.cond).value(e)];case 1:return[4,De(t.sent())?n.renderTemplates(this.templates,e,r):n.renderTemplates(this.elseTemplates,e,r)];case 2:return t.sent(),[2]}})}},break:{render:function(t,e){e.break=!0}},continue:{render:function(t,e){e.continue=!0}}},Dr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&#34;","'":"&#39;"},Ar={"&amp;":"&","&lt;":"<","&gt;":">","&#34;":'"',"&#39;":"'"};function _r(t){return l(t).replace(/&|<|>|"|'/g,function(t){return Dr[t]})}var jr=Math.abs,Wr=Math.max,Vr=Math.min,Cr=Math.ceil,Br=Math.floor;var Hr=/%([-_0^#:]+)?(\d+)?([EO])?(.)/,zr=["January","February","March","April","May","June","July","August","September","October","November","December"],Ur=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Qr=zr.map(Yr),Ir=Ur.map(Yr),Jr={1:"st",2:"nd",3:"rd",default:"th"};function Yr(t){return t.slice(0,3)}function Gr(t){for(var e=0,r=0;r<t.getMonth();++r)e+=[31,function(t){var e=t.getFullYear();return!(0!=(3&e)||!(e%100||e%400==0&&e))}(t)?29:28,31,30,31,30,31,31,30,31,30,31][r];return e+t.getDate()}function $r(t,e){var r=Gr(t)+(e-t.getDay()),n=7-new Date(t.getFullYear(),0,1).getDay()+e;return String(Math.floor((r-n)/7)+1)}var Xr={d:2,e:2,H:2,I:2,j:3,k:2,l:2,L:3,m:2,M:2,S:2,U:2,W:2},Zr={a:" ",A:" ",b:" ",B:" ",c:" ",e:" ",k:" ",l:" ",p:" ",P:" "},Kr={a:function(t){return Ir[t.getDay()]},A:function(t){return Ur[t.getDay()]},b:function(t){return Qr[t.getMonth()]},B:function(t){return zr[t.getMonth()]},c:function(t){return t.toLocaleString()},C:function(t){return function(t){return parseInt(t.getFullYear().toString().substring(0,2),10)}(t)},d:function(t){return t.getDate()},e:function(t){return t.getDate()},H:function(t){return t.getHours()},I:function(t){return String(t.getHours()%12||12)},j:function(t){return Gr(t)},k:function(t){return t.getHours()},l:function(t){return String(t.getHours()%12||12)},L:function(t){return t.getMilliseconds()},m:function(t){return t.getMonth()+1},M:function(t){return t.getMinutes()},N:function(t,e){var r=Number(e.width)||9;return function(t,e,r){return void 0===r&&(r=" "),x(t,e,r,function(t,e){return t+e})}(String(t.getMilliseconds()).substr(0,r),r,"0")},p:function(t){return t.getHours()<12?"AM":"PM"},P:function(t){return t.getHours()<12?"am":"pm"},q:function(t){return function(t){var e=t.getDate().toString(),r=parseInt(e.slice(-1));return Jr[r]||Jr.default}(t)},s:function(t){return Math.round(t.valueOf()/1e3)},S:function(t){return t.getSeconds()},u:function(t){return t.getDay()||7},U:function(t){return $r(t,0)},w:function(t){return t.getDay()},W:function(t){return $r(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,e){var r=t.getTimezoneOffset(),n=Math.abs(r),i=n%60;return(0<r?"-":"+")+k(Math.floor(n/60),2,"0")+(e.flags[":"]?":":"")+k(i,2,"0")},t:function(){return"\t"},n:function(){return"\n"},"%":function(){return"%"}};function tn(t,e){var r,n,i=m(e,5),s=i[0],o=i[1],a=void 0===o?"":o,u=i[2],c=i[3],l=i[4],h=Kr[l];if(!h)return s;var p={};try{for(var f=q(a),d=f.next();!d.done;d=f.next()){p[d.value]=!0}}catch(t){r={error:t}}finally{try{d&&!d.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}var v=String(h(t,{flags:p,width:u,modifier:c})),g=Zr[l]||"0",y=u||Xr[l]||0;return p["^"]?v=v.toUpperCase():p["#"]&&(v=function(t){return b(t).some(function(t){return"a"<=t&&t<="z"})?t.toUpperCase():t.toLowerCase()}(v)),p._?g=" ":p[0]&&(g="0"),p["-"]&&(y=0),k(v,y,g)}Kr.h=Kr.b;var en=Object.freeze({escape:_r,escapeOnce:function(t){return _r(function(t){return String(t).replace(/&(amp|lt|gt|#34|#39);/g,function(t){return Ar[t]})}(t))},newlineToBr:function(t){return t.replace(/\n/g,"<br/>")},stripHtml:function(t){return t.replace(/<script.*?<\/script>|<!--.*?-->|<style.*?<\/style>|<.*?>/g,"")},abs:jr,atLeast:Wr,atMost:Vr,ceil:Cr,dividedBy:function(t,e){return t/e},floor:Br,minus:function(t,e){return t-e},modulo:function(t,e){return t%e},times:function(t,e){return t*e},round:function(t,e){void 0===e&&(e=0);var r=Math.pow(10,e);return Math.round(t*r)/r},plus:function(t,e){return Number(t)+Number(e)},sortNatural:function(t,r){return t&&t.sort?void 0!==r?b(t).sort(function(t,e){return F(t[r],e[r])}):b(t).sort(F):[]},urlDecode:function(t){return t.split("+").map(decodeURIComponent).join(" ")},urlEncode:function(t){return t.split(" ").map(encodeURIComponent).join("+")},join:function(t,e){return t.join(void 0===e?" ":e)},last:function(t){return v(t)?g(t):""},first:function(t){return v(t)?t[0]:""},reverse:function(t){return b(t).reverse()},sort:function(t,e){function r(t){return e?n.context.getFromScope(t,e.split(".")):t}var n=this;return lr(t).sort(function(t,e){return(t=r(t))<(e=r(e))?-1:e<t?1:0})},size:function(t){return t&&t.length||0},map:function(t,e){var r=this;return lr(t).map(function(t){return r.context.getFromScope(t,e.split("."))})},concat:function(t,e){return lr(t).concat(e)},slice:function(t,e,r){return void 0===r&&(r=1),e=e<0?t.length+e:e,t.slice(e,e+r)},where:function(t,r,n){var i=this;return lr(t).filter(function(t){var e=i.context.getFromScope(t,String(r).split("."));return void 0===n?Pe(e):e===n})},uniq:function(t){var e={};return(t||[]).filter(function(t){return!e.hasOwnProperty(String(t))&&(e[String(t)]=!0)})},date:function(t,e){var r=t;return"now"===t||"today"===t?r=new Date:p(t)?r=new Date(1e3*t):u(t)&&(r=/^\d+$/.test(t)?new Date(1e3*+t):new Date(t)),function(t){return t instanceof Date&&!isNaN(t.getTime())}(r)?function(t,e){for(var r,n="",i=e;r=Hr.exec(i);)n+=i.slice(0,r.index),i=i.slice(r.index+r[0].length),n+=tn(t,r);return n+i}(r,e):t},Default:function(t,e){return v(t)||u(t)?t.length?t:e:De(h(t))?e:t},json:function(t){return JSON.stringify(t)},append:function(t,e){return Jt(void 0!==e,function(){return"append expect 2 arguments"}),l(t)+l(e)},prepend:function(t,e){return Jt(void 0!==e,function(){return"prepend expect 2 arguments"}),l(e)+l(t)},lstrip:function(t){return l(t).replace(/^\s+/,"")},downcase:function(t){return l(t).toLowerCase()},upcase:function(t){return l(t).toUpperCase()},remove:function(t,e){return l(t).split(e).join("")},removeFirst:function(t,e){return l(t).replace(e,"")},rstrip:function(t){return l(t).replace(/\s+$/,"")},split:function(t,e){return l(t).split(e)},strip:function(t){return l(t).trim()},stripNewlines:function(t){return l(t).replace(/\n/g,"")},capitalize:function(t){return(t=l(t)).charAt(0).toUpperCase()+t.slice(1)},replace:function(t,e,r){return l(t).split(e).join(r)},replaceFirst:function(t,e,r){return l(t).replace(e,r)},truncate:function(t,e,r){return void 0===e&&(e=50),void 0===r&&(r="..."),(t=l(t)).length<=e?t:t.substr(0,e-r.length)+r},truncatewords:function(t,e,r){void 0===e&&(e=15),void 0===r&&(r="...");var n=t.split(/\s+/),i=n.slice(0,e).join(" ");return n.length>=e&&(i+=r),i}}),rn=(nn.prototype.get=function(t){var e=this.impls[t];return Jt(e,function(){return'tag "'+t+'" not found'}),e},nn.prototype.set=function(t,e){this.impls[t]=e},nn);function nn(){this.impls={}}var sn=(on.prototype.get=function(t){var e=this.impls[t];return Jt(e||!this.strictFilters,function(){return"undefined filter: "+t}),e},on.prototype.set=function(t,e){this.impls[t]=e},on.prototype.create=function(t,e){return new Qe(t,this.get(t),e)},on);function on(t){this.strictFilters=t,this.impls={}}var an=(un.prototype.parse=function(t,e){var r=new we(t,e).readTopLevelTokens(this.options);return this.parser.parse(r)},un.prototype._render=function(t,e,r,n){var i=w({},this.options,P(r)),s=new A(e,i,n);return this.renderer.renderTemplates(t,s)},un.prototype.render=function(e,r,n){return s(this,void 0,void 0,function(){return O(this,function(t){return[2,ar(this._render(e,r,n,!1))]})})},un.prototype.renderSync=function(t,e,r){return ur(this._render(t,e,r,!0))},un.prototype._parseAndRender=function(t,e,r,n){var i=this.parse(t);return this._render(i,e,r,n)},un.prototype.parseAndRender=function(e,r,n){return s(this,void 0,void 0,function(){return O(this,function(t){return[2,ar(this._parseAndRender(e,r,n,!1))]})})},un.prototype.parseAndRenderSync=function(t,e,r){return ur(this._parseAndRender(t,e,r,!0))},un.prototype._parseFile=function(e,r,n){var i,s,o,a,u,c,l,h,p,f,d,v,g,y,m=this;return O(this,function(t){switch(t.label){case 0:i=w({},this.options,P(r)),s=i.root.map(function(t){return m.fs.resolve(t,e,i.extname)}),void 0!==this.fs.fallback&&void 0!==(u=this.fs.fallback(e))&&s.push(u),t.label=1;case 1:t.trys.push([1,13,14,15]),o=q(s),a=o.next(),t.label=2;case 2:return a.done?[3,12]:(u=a.value,(c=i.cache)?[4,c.read(u)]:[3,4]);case 3:if(l=t.sent())return[2,l];t.label=4;case 4:return n?(h=this.fs.existsSync(u),[3,7]):[3,5];case 5:return[4,this.fs.exists(u)];case 6:h=t.sent(),t.label=7;case 7:return h?(f=this.parse,n?(d=this.fs.readFileSync(u),[3,10]):[3,8]):[3,11];case 8:return[4,this.fs.readFile(u)];case 9:d=t.sent(),t.label=10;case 10:return p=f.apply(this,[d,u]),c&&c.write(u,p),[2,p];case 11:return a=o.next(),[3,2];case 12:return[3,15];case 13:return v=t.sent(),g={error:v},[3,15];case 14:try{a&&!a.done&&(y=o.return)&&y.call(o)}finally{if(g)throw g.error}return[7];case 15:throw this.lookupError(e,i.root)}})},un.prototype.parseFile=function(e,r){return s(this,void 0,void 0,function(){return O(this,function(t){return[2,ar(this._parseFile(e,r,!1))]})})},un.prototype.parseFileSync=function(t,e){return ur(this._parseFile(t,e,!0))},un.prototype.renderFile=function(r,n,i){return s(this,void 0,void 0,function(){var e;return O(this,function(t){switch(t.label){case 0:return[4,this.parseFile(r,i)];case 1:return e=t.sent(),[2,this.render(e,n,i)]}})})},un.prototype.renderFileSync=function(t,e,r){var n=P(r),i=this.parseFileSync(t,n);return this.renderSync(i,e,r)},un.prototype._evalValue=function(t,e){return new Je(t,this.filters).value(e)},un.prototype.evalValue=function(e,r){return s(this,void 0,void 0,function(){return O(this,function(t){return[2,ar(this._evalValue(e,r))]})})},un.prototype.evalValueSync=function(t,e){return ur(this._evalValue(t,e))},un.prototype.registerFilter=function(t,e){this.filters.set(t,e)},un.prototype.registerTag=function(t,e){this.tags.set(t,e)},un.prototype.plugin=function(t){return t.call(this,un)},un.prototype.express=function(){var i=this;return function(t,e,r){var n={root:b(D(this.root),i.options.root)};i.renderFile(t,e,n).then(function(t){return r(null,t)},r)}},un.prototype.lookupError=function(t,e){var r=new Error("ENOENT");return r.message='ENOENT: Failed to lookup "'+t+'" in "'+e+'"',r.code="ENOENT",r},un.prototype.getTemplate=function(e,r){return s(this,void 0,void 0,function(){return O(this,function(t){return[2,this.parseFile(e,r)]})})},un.prototype.getTemplateSync=function(t,e){return this.parseFileSync(t,e)},un);function un(t){var r=this;void 0===t&&(t={}),this.options=function(t){return w({},N,t)}(P(t)),this.parser=new er(this),this.renderer=new xe,this.fs=t.fs||V,this.filters=new sn(this.options.strictFilters),this.tags=new rn,d(Pr,function(t,e){return r.registerTag(R(e),t)}),d(en,function(t,e){return r.registerFilter(R(e),t)})}t.AssertionError=Qt,t.Context=A,t.Drop=i,t.Emitter=Te,t.Expression=_e,t.Hash=Ce,t.Liquid=an,t.ParseError=Vt,t.ParseStream=Oe,t.TagToken=le,t.Token=it,t.TokenizationError=_t,t.Tokenizer=we,t.TypeGuards=Z,t.assert=Jt,t.evalQuotedToken=Ve,t.evalToken=We,t.isFalsy=De,t.isTruthy=Pe,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=liquid.browser.min.js.map
