/** * Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2. * Original file: /npm/liquidjs@9.42.0/dist/liquid.browser.esm.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ var t=function(){return t=Object.assign||function(t){for(var e,i=1,r=arguments.length;ic(t))).join(""):String(t)}function u(t){return t instanceof i&&a(t.valueOf)?t.valueOf():t}function p(t){return"number"==typeof t}function d(t){return t&&a(t.toLiquid)?d(t.toLiquid()):t}function f(t){return null==t}function g(t){return"[object Array]"===r.call(t)}function m(t,e){t=t||{};for(const i in t)if(n.call(t,i)&&!1===e(t[i],i,t))break;return t}function w(t){return t[t.length-1]}function y(t){const e=typeof t;return null!==t&&("object"===e||"function"===e)}function T(t,e,i=1){const r=[];for(let s=t;se+t))}function v(t,e,i,r){let s=e-(t=String(t)).length;for(;s-- >0;)t=r(t,i);return t}function b(t){return t}function x(t){return t.replace(/(\w?)([A-Z])/g,((t,e,i)=>(e?e+"_":"")+i.toLowerCase()))}function q(t,e){return null==t&&null==e?0:null==t?1:null==e||(t=s.call(t))<(e=s.call(e))?-1:t>e?1:0}function O(t){return(...e)=>t(...e.map(u))}function F(t){return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}class R{constructor(t,e,i,r){this.key=t,this.value=e,this.next=i,this.prev=r}}class S{constructor(t,e=0){this.limit=t,this.size=e,this.cache={},this.head=new R("HEAD",null,null,null),this.tail=new R("TAIL",null,null,null),this.head.next=this.tail,this.tail.prev=this.head}write(t,e){if(this.cache[t])this.cache[t].value=e;else{const i=new R(t,e,this.head.next,this.head);this.head.next.prev=i,this.head.next=i,this.cache[t]=i,this.size++,this.ensureLimit()}}read(t){if(!this.cache[t])return;const{value:e}=this.cache[t];return this.remove(t),this.write(t,e),e}remove(t){const e=this.cache[t];e.prev.next=e.next,e.next.prev=e.prev,delete this.cache[t],this.size--}clear(){this.head.next=this.tail,this.tail.prev=this.head,this.size=0,this.cache={}}ensureLimit(){this.size>this.limit&&this.remove(this.tail.prev.key)}}function L(t,e){const i=document.createElement("base");i.href=t;const r=document.getElementsByTagName("head")[0];r.insertBefore(i,r.firstChild);const s=document.createElement("a");s.href=e;const n=s.href;return r.removeChild(i),n}var E=Object.freeze({__proto__:null,resolve:function(t,e,i){return t.length&&"/"!==w(t)&&(t+="/"),L(t,e).replace(/^(\w+:\/\/[^/]+)(\/[^?]+)/,((t,e,r)=>{const s=r.split("/").pop();return/\.\w+$/.test(s)?t:e+r+i}))},readFile:function(t){return e(this,void 0,void 0,(function*(){return new Promise(((e,i)=>{const r=new XMLHttpRequest;r.onload=()=>{r.status>=200&&r.status<300?e(r.responseText):i(new Error(r.statusText))},r.onerror=()=>{i(new Error("An error occurred whilst receiving the response."))},r.open("GET",t),r.send()}))}))},readFileSync:function(t){const e=new XMLHttpRequest;if(e.open("GET",t,!1),e.send(),e.status<200||e.status>=300)throw new Error(e.statusText);return e.responseText},exists:function(t){return e(this,void 0,void 0,(function*(){return!0}))},existsSync:function(t){return!0},dirname:function(t){return L(t,".")},sep:"/"});function D(t){return t&&a(t.equals)}function M(t,e){return!P(t,e)}function P(t,e){return e.opts.jsTruthy?!t:!1===t||null==t}const $={"==":(t,e)=>D(t)?t.equals(e):D(e)?e.equals(t):u(t)===u(e),"!=":(t,e)=>D(t)?!t.equals(e):D(e)?!e.equals(t):u(t)!==u(e),">":(t,e)=>D(t)?t.gt(e):D(e)?e.lt(t):u(t)>u(e),"<":(t,e)=>D(t)?t.lt(e):D(e)?e.gt(t):u(t)=":(t,e)=>D(t)?t.geq(e):D(e)?e.leq(t):u(t)>=u(e),"<=":(t,e)=>D(t)?t.leq(e):D(e)?e.geq(t):u(t)<=u(e),contains:(t,e)=>(t=u(t),e=u(e),!(!t||!a(t.indexOf))&&t.indexOf(e)>-1),and:(t,e,i)=>M(u(t),i)&&M(u(e),i),or:(t,e,i)=>M(u(t),i)||M(u(e),i)},N=[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],j=1,_=4,A=16;function I(t){const e={};for(const[i,r]of Object.entries(t)){let t=e;for(let e=0;e":">",'"':""","'":"'"},B={"&":"&","<":"<",">":">",""":'"',"'":"'"};function V(t){return c(t).replace(/&|<|>|"|'/g,(t=>z[t]))}const C=O(Math.abs),H=O(Math.max),U=O(Math.min),Q=O(Math.ceil),W=O(((t,e,i=!1)=>i?Math.floor(t/e):t/e)),Y=O(Math.floor),J=O(((t,e)=>t-e)),G=O(((t,e)=>t%e)),X=O(((t,e)=>t*e));function Z(t){return g(t=u(t))?t:o(t)&&t.length>0?[t]:y(e=t)&&Symbol.iterator in e?Array.from(t):y(t)?Object.keys(t).map((e=>[e,t[e]])):[];var e}function K(t){return f(t)?[]:g(t)?t:[t]}const tt=O(((t,e)=>K(t).join(void 0===e?" ":e))),et=O((t=>g(t)?w(t):"")),it=O((t=>g(t)?t[0]:"")),rt=O((t=>[...K(t)].reverse()));const st=/%([-_0^#:]+)?(\d+)?([EO])?(.)/,nt=["January","February","March","April","May","June","July","August","September","October","November","December"],ot=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],at=nt.map(ct),lt=ot.map(ct),ht={1:"st",2:"nd",3:"rd",default:"th"};function ct(t){return t.slice(0,3)}function ut(t){const e=function(t){const e=t.getFullYear();return!(0!=(3&e)||!(e%100||e%400==0&&e))}(t)?29:28;return[31,e,31,30,31,30,31,31,30,31,30,31]}function pt(t){let e=0;for(let i=0;ilt[t.getDay()],A:t=>ot[t.getDay()],b:t=>at[t.getMonth()],B:t=>nt[t.getMonth()],c:t=>t.toLocaleString(),C:t=>function(t){return parseInt(t.getFullYear().toString().substring(0,2),10)}(t),d:t=>t.getDate(),e:t=>t.getDate(),H:t=>t.getHours(),I:t=>String(t.getHours()%12||12),j:t=>pt(t),k:t=>t.getHours(),l:t=>String(t.getHours()%12||12),L:t=>t.getMilliseconds(),m:t=>t.getMonth()+1,M:t=>t.getMinutes(),N:(t,e)=>{const i=Number(e.width)||9;return function(t,e,i=" "){return v(t,e,i,((t,e)=>t+e))}(String(t.getMilliseconds()).slice(0,i),i,"0")},p:t=>t.getHours()<12?"AM":"PM",P:t=>t.getHours()<12?"am":"pm",q:t=>function(t){const e=t.getDate().toString(),i=parseInt(e.slice(-1));return ht[i]||ht.default}(t),s:t=>Math.round(t.getTime()/1e3),S:t=>t.getSeconds(),u:t=>t.getDay()||7,U:t=>dt(t,0),w:t=>t.getDay(),W:t=>dt(t,1),x:t=>t.toLocaleDateString(),X:t=>t.toLocaleTimeString(),y:t=>t.getFullYear().toString().slice(2,4),Y:t=>t.getFullYear(),z:(t,e)=>{const i=Math.abs(t.getTimezoneOffset()),r=Math.floor(i/60),s=i%60;return(t.getTimezoneOffset()>0?"-":"+")+k(r,2,"0")+(e.flags[":"]?":":"")+k(s,2,"0")},t:()=>"\t",n:()=>"\n","%":()=>"%"};function wt(t,e){const[i,r="",s,n,o]=e,a=mt[o];if(!a)return i;const l={};for(const t of r)l[t]=!0;let h=String(a(t,{flags:l,width:s,modifier:n})),c=gt[o]||"0",u=s||ft[o]||0;var p;return l["^"]?h=h.toUpperCase():l["#"]&&(p=h,h=[...p].some((t=>t>="a"&&t<="z"))?p.toUpperCase():p.toLowerCase()),l._?c=" ":l[0]&&(c="0"),l["-"]&&(u=0),k(h,u,c)}mt.h=mt.b;const yt=(new Date).getTimezoneOffset(),Tt=/([zZ]|([+-])(\d{2}):(\d{2}))$/;class kt{constructor(t,e){if(t instanceof kt)this.date=t.date,e=t.timezoneOffset;else{const i=6e4*(yt-e),r=new Date(t).getTime()+i;this.date=new Date(r)}this.timezoneOffset=e}getTime(){return this.date.getTime()}getMilliseconds(){return this.date.getMilliseconds()}getSeconds(){return this.date.getSeconds()}getMinutes(){return this.date.getMinutes()}getHours(){return this.date.getHours()}getDay(){return this.date.getDay()}getDate(){return this.date.getDate()}getMonth(){return this.date.getMonth()}getFullYear(){return this.date.getFullYear()}toLocaleTimeString(t){return this.date.toLocaleTimeString(t)}toLocaleDateString(t){return this.date.toLocaleDateString(t)}getTimezoneOffset(){return this.timezoneOffset}static createDateFixedToTimezone(t){const e=t.match(Tt);if(e&&"Z"===e[1])return new kt(+new Date(t),0);if(e&&e[2]&&e[3]&&e[4]){const[,,i,r,s]=e,n=("+"===i?-1:1)*(60*parseInt(r,10)+parseInt(s,10));return new kt(+new Date(t),n)}return new Date(t)}}const vt=b;class bt extends Error{constructor(t,e){super(t.message),this.originalError=t,this.token=e,this.context=""}update(){const t=this.originalError;this.context=function(t){const[e]=t.getPosition(),i=t.input.split("\n"),r=Math.max(e-2,1),s=Math.min(e+3,i.length);return T(r,s+1).map((t=>`${t===e?">> ":" "}${k(String(t),String(s).length)}| ${i[t-1]}`)).join("\n")}(this.token),this.message=function(t,e){e.file&&(t+=`, file:${e.file}`);const[i,r]=e.getPosition();return t+=`, line:${i}, col:${r}`}(t.message,this.token),this.stack=this.message+"\n"+this.context+"\n"+this.stack+"\nFrom "+t.stack}}class xt extends bt{constructor(t,e){super(new Error(t),e),this.name="TokenizationError",super.update()}}class qt extends bt{constructor(t,e){super(t,e),this.name="ParseError",this.message=t.message,super.update()}}class Ot extends bt{constructor(t,e){super(t,e.token),this.name="RenderError",this.message=t.message,super.update()}static is(t){return"RenderError"===t.name}}class Ft extends bt{constructor(t,e){super(t,e),this.name="UndefinedVariableError",this.message=t.message,super.update()}}class Rt extends Error{constructor(t){super(`undefined variable: ${t}`),this.name="InternalUndefinedVariableError",this.variableName=t}}class St extends Error{constructor(t){super(t),this.name="AssertionError",this.message=t+""}}function Lt(t,e){if(!t){const i="function"==typeof e?e():e||`expect ${t} to be true`;throw new St(i)}}var Et,Dt=Object.freeze({__proto__:null,escape:V,escapeOnce:function(t){return V(function(t){return c(t).replace(/&(amp|lt|gt|#34|#39);/g,(t=>B[t]))}(c(t)))},newlineToBr:function(t){return c(t).replace(/\n/g,"
\n")},stripHtml:function(t){return c(t).replace(/|||<.*?>/g,"")},abs:C,atLeast:H,atMost:U,ceil:Q,dividedBy:W,floor:Y,minus:J,modulo:G,times:X,round:function(t,e=0){t=u(t),e=u(e);const i=Math.pow(10,e);return Math.round(t*i)/i},plus:function(t,e){return t=u(t),e=u(e),Number(t)+Number(e)},urlDecode:t=>c(t).split("+").map(decodeURIComponent).join(" "),urlEncode:t=>c(t).split(" ").map(encodeURIComponent).join("+"),join:tt,last:et,first:it,reverse:rt,sort:function*(t,e){const i=[];for(const r of K(u(t)))i.push([r,e?yield this.context._getFromScope(r,c(e).split(".")):r]);return i.sort(((t,e)=>{const i=t[1],r=e[1];return ir?1:0})).map((t=>t[0]))},sortNatural:function(t,e){t=u(t);const i=c(e),r=void 0===e?q:(t,e)=>q(t[i],e[i]);return[...K(t)].sort(r)},size:t=>t&&t.length||0,map:function*(t,e){const i=[];for(const r of K(u(t)))i.push(yield this.context._getFromScope(r,c(e).split(".")));return i},compact:function(t){return K(t=u(t)).filter((t=>!f(u(t))))},concat:function(t,e=[]){return t=u(t),e=K(e).map((t=>u(t))),K(t).concat(e)},slice:function(t,e,i=1){return f(t=u(t))?[]:(g(t)||(t=c(t)),e=e<0?t.length+e:e,t.slice(e,e+i))},where:function*(t,e,i){const r=[];t=K(u(t));for(const i of t)r.push(yield this.context._getFromScope(i,c(e).split(".")));return t.filter(((t,e)=>void 0===i?M(r[e],this.context):D(i)?i.equals(r[e]):r[e]===i))},uniq:function(t){t=u(t);const e={};return(t||[]).filter((t=>!n.call(e,String(t))&&(e[String(t)]=!0,!0)))},date:function(t,e){const i=this.context.opts;let r;return t=u(t),e=c(e),r="now"===t||"today"===t?new Date:p(t)?new Date(1e3*t):o(t)?/^\d+$/.test(t)?new Date(1e3*+t):i.preserveTimezones?kt.createDateFixedToTimezone(t):new Date(t):t,function(t){return(t instanceof Date||t instanceof kt)&&!isNaN(t.getTime())}(r)?(i.hasOwnProperty("timezoneOffset")&&(r=new kt(r,i.timezoneOffset)),function(t,e){let i,r="",s=e;for(;i=st.exec(s);)r+=s.slice(0,i.index),s=s.slice(i.index+i[0].length),r+=wt(t,i);return r+s}(r,e)):t},Default:function(t,e,...i){return g(t=u(t))||o(t)?t.length?t:e:(!1!==t||!new Map(i).get("allow_false"))&&(P(t,this.context)?e:t)},json:function(t){return JSON.stringify(t)},raw:vt,append:function(t,e){return Lt(2===arguments.length,"append expect 2 arguments"),c(t)+c(e)},prepend:function(t,e){return Lt(2===arguments.length,"prepend expect 2 arguments"),c(e)+c(t)},lstrip:function(t,e){return e?(e=F(c(e)),c(t).replace(new RegExp(`^[${e}]+`,"g"),"")):c(t).replace(/^\s+/,"")},downcase:function(t){return c(t).toLowerCase()},upcase:function(t){return c(t).toUpperCase()},remove:function(t,e){return c(t).split(String(e)).join("")},removeFirst:function(t,e){return c(t).replace(String(e),"")},rstrip:function(t,e){return e?(e=F(c(e)),c(t).replace(new RegExp(`[${e}]+$`,"g"),"")):c(t).replace(/\s+$/,"")},split:function(t,e){const i=c(t).split(String(e));for(;i.length&&""===i[i.length-1];)i.pop();return i},strip:function(t,e){return e?(e=F(c(e)),c(t).replace(new RegExp(`^[${e}]+`,"g"),"").replace(new RegExp(`[${e}]+$`,"g"),"")):c(t).trim()},stripNewlines:function(t){return c(t).replace(/\n/g,"")},capitalize:function(t){return(t=c(t)).charAt(0).toUpperCase()+t.slice(1).toLowerCase()},replace:function(t,e,i){return c(t).split(String(e)).join(i)},replaceFirst:function(t,e,i){return c(t).replace(String(e),i)},truncate:function(t,e=50,i="..."){return(t=c(t)).length<=e?t:t.substring(0,e-i.length)+i},truncatewords:function(t,e=15,i="..."){const r=c(t).split(/\s+/);let s=r.slice(0,e).join(" ");return r.length>=e&&(s+=i),s}});function Mt(t){return!!(Ct(t)&Et.Delimited)}function Pt(t){return Ct(t)===Et.Operator}function $t(t){return Ct(t)===Et.HTML}function Nt(t){return Ct(t)===Et.Output}function jt(t){return Ct(t)===Et.Tag}function _t(t){return Ct(t)===Et.Quoted}function At(t){return Ct(t)===Et.Literal}function It(t){return Ct(t)===Et.Number}function zt(t){return Ct(t)===Et.PropertyAccess}function Bt(t){return Ct(t)===Et.Word}function Vt(t){return Ct(t)===Et.Range}function Ct(t){return t?t.kind:-1}!function(t){t[t.Number=1]="Number",t[t.Literal=2]="Literal",t[t.Tag=4]="Tag",t[t.Output=8]="Output",t[t.HTML=16]="HTML",t[t.Filter=32]="Filter",t[t.Hash=64]="Hash",t[t.PropertyAccess=128]="PropertyAccess",t[t.Word=256]="Word",t[t.Range=512]="Range",t[t.Quoted=1024]="Quoted",t[t.Operator=2048]="Operator",t[t.Delimited=12]="Delimited"}(Et||(Et={}));var Ht=Object.freeze({__proto__:null,isDelimitedToken:Mt,isOperatorToken:Pt,isHTMLToken:$t,isOutputToken:Nt,isTagToken:jt,isQuotedToken:_t,isLiteralToken:At,isNumberToken:It,isPropertyAccessToken:zt,isWordToken:Bt,isRangeToken:Vt});class Ut extends i{equals(t){return!(t instanceof Ut)&&(o(t=u(t))||g(t)?0===t.length:!!y(t)&&0===Object.keys(t).length)}gt(){return!1}geq(){return!1}lt(){return!1}leq(){return!1}valueOf(){return""}}const Qt=new class extends i{equals(t){return f(u(t))}gt(){return!1}geq(){return!1}lt(){return!1}leq(){return!1}valueOf(){return null}},Wt={true:!0,false:!1,nil:Qt,null:Qt,empty:new Ut,blank:new class extends Ut{equals(t){return!1===t||(!!f(u(t))||(o(t)?/^\s*$/.test(t):super.equals(t)))}}},Yt=/[\da-fA-F]/,Jt=/[0-7]/,Gt={b:"\b",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v"};function Xt(t){const e=t.charCodeAt(0);return e>=97?e-87:e>=65?e-55:e-48}function Zt(t){let e="";for(let i=1;ii.getPrecedence();)yield e.pop();e.push(i)}else yield i;for(;e.length;)yield e.pop()}class le{constructor(t,e,i,r,s){this.kind=t,this.input=e,this.begin=i,this.end=r,this.file=s}getText(){return this.input.slice(this.begin,this.end)}getPosition(){let[t,e]=[1,1];for(let i=0;i":1,"<":1,">=":1,"<=":1,contains:1,and:0,or:0};class me extends le{constructor(t,e,i,r){super(Et.Operator,t,e,i,r),this.input=t,this.begin=e,this.end=i,this.file=r,this.operator=this.getText()}getPrecedence(){const t=this.getText();return t in ge?ge[t]:1}}class we extends le{constructor(t,e,i){super(Et.PropertyAccess,t.input,t.begin,i,t.file),this.variable=t,this.props=e,this.propertyName=this.variable instanceof de?this.variable.getText():Zt(this.variable.getText())}}class ye extends le{constructor(t,e,i,r,s,n){super(Et.Filter,i,r,s,n),this.name=t,this.args=e}}class Te extends le{constructor(t,e,i,r,s,n){super(Et.Hash,t,e,i,n),this.input=t,this.begin=e,this.end=i,this.name=r,this.value=s,this.file=n}}class ke extends le{constructor(t,e,i,r){super(Et.Quoted,t,e,i,r),this.input=t,this.begin=e,this.end=i,this.file=r}}class ve extends le{constructor(t,e,i,r){super(Et.HTML,t,e,i,r),this.input=t,this.begin=e,this.end=i,this.file=r,this.trimLeft=0,this.trimRight=0}getContent(){return this.input.slice(this.begin+this.trimLeft,this.end-this.trimRight)}}class be extends le{constructor(t,e,i,r,s,n){super(Et.Range,t,e,i,n),this.input=t,this.begin=e,this.end=i,this.lhs=r,this.rhs=s,this.file=n}}class xe extends he{constructor(t,e,i,r,s){const{trimOutputLeft:n,trimOutputRight:o,outputDelimiterLeft:a,outputDelimiterRight:l}=r,h=t.slice(e+a.length,i-l.length);super(Et.Output,h,t,e,i,n,o,s)}}class qe extends he{constructor(t,e,i,r,s){const n=t.slice(e,i);if(super(Et.Tag,n,t,e,i,!1,!1,s),/\S/.test(n)){const t=new Oe(this.content,r.operatorsTrie);if(this.name=t.readTagName(),!this.name)throw new xt("illegal liquid tag syntax",this);t.skipBlank(),this.args=t.remaining()}else this.name="",this.args=""}}class Oe{constructor(t,e=si.operatorsTrie,i=""){this.input=t,this.trie=e,this.file=i,this.p=0,this.rawBeginAt=-1,this.N=t.length}readExpression(){return new ie(this.readExpressionTokens())}*readExpressionTokens(){const t=this.readValue();if(t)for(yield t;this.p`unexpected token at ${this.snapshot()}`)),this.p++;const t=this.p,e=this.readIdentifier();if(!e.size())return null;const i=[];if(this.skipBlank(),":"===this.peek())do{++this.p;const t=this.readFilterArg();t&&i.push(t),this.skipBlank(),Lt(this.end()||","===this.peek()||"|"===this.peek(),(()=>`unexpected character ${this.snapshot()}`))}while(","===this.peek());return new ye(e.getText(),i,this.input,t,this.p,this.file)}readFilterArg(){const t=this.readValue();if(!t)return;if(this.skipBlank(),":"!==this.peek())return t;++this.p;const e=this.readValue();return[t.getText(),e]}readTopLevelTokens(t=si){const e=[];for(;this.p-1?this.readEndrawOrRawContent(t):this.match(e)?this.readTagToken(t):this.match(i)?this.readOutputToken(t):this.readHTMLToken([e,i])}readHTMLToken(t){const e=this.p;for(;this.pthis.match(t)));)++this.p;return new ve(this.input,e,this.p,this.file)}readTagToken(t=si){const{file:e,input:i}=this,r=this.p;if(-1===this.readToDelimiter(t.tagDelimiterRight))throw this.mkError(`tag ${this.snapshot(r)} not closed`,r);const s=new Fe(i,r,this.p,t,e);return"raw"===s.name&&(this.rawBeginAt=r),s}readToDelimiter(t){for(;this.pi?e.slice(0,i-3)+"...":e));var e,i}readWord(){return console.warn("Tokenizer#readWord() will be removed, use #readIdentifier instead"),this.readIdentifier()}readIdentifier(){this.skipBlank();const t=this.p;for(;this.peekType()&j;)++this.p;return new de(this.input,t,this.p,this.file)}readTagName(){return this.skipBlank(),"#"===this.input[this.p]?this.input.slice(this.p,++this.p):this.readIdentifier().getText()}readHashes(t){const e=[];for(;;){const i=this.readHash(t);if(!i)return e;e.push(i)}}readHash(t){this.skipBlank(),","===this.peek()&&++this.p;const e=this.p,i=this.readIdentifier();if(!i.size())return;let r;this.skipBlank();const s=t?"=":":";return this.peek()===s&&(++this.p,r=this.readValue()),new Te(this.input,e,this.p,i,r,this.file)}remaining(){return this.input.slice(this.p)}advance(t=1){this.p+=t}end(){return this.p>=this.N}readTo(t){for(;this.p`unexpected token ${this.snapshot()}, value expected`)),t}readQuoted(){this.skipBlank();const t=this.p;if(!(8&this.peekType()))return;++this.p;let e=!1;for(;this.pnew Le(t,e.filters.get(t),i,e)))}*value(t,e){e=e||t.opts.lenientIf&&this.filters.length>0&&"default"===this.filters[0].name;let i=yield this.initial.evaluate(t,e);for(const e of this.filters)i=yield e.render(i,t);return i}}var De={parse:function(t){const e=new Oe(t.args,this.liquid.options.operatorsTrie);this.key=e.readIdentifier().content,e.skipBlank(),Lt("="===e.peek(),(()=>`illegal token ${t.getText()}`)),e.advance(),this.value=new Ee(e.remaining(),this.liquid)},render:function*(t){t.bottom()[this.key]=yield this.value.value(t,this.liquid.options.lenientIf)}};class Me extends i{constructor(t,e,i){super(),this.i=0,this.length=t,this.name=`${i}-${e}`}next(){this.i++}index0(){return this.i}index(){return this.i+1}first(){return 0===this.i}last(){return this.i===this.length-1}rindex(){return this.length-this.i}rindex0(){return this.length-this.i-1}valueOf(){return JSON.stringify(this)}}const Pe=["offset","limit","reversed"];var $e={type:"block",parse:function(t,e){const i=new Oe(t.args,this.liquid.options.operatorsTrie),r=i.readIdentifier(),s=i.readIdentifier(),n=i.readValue();let o;Lt(r.size()&&"in"===s.content&&n,(()=>`illegal tag: ${t.getText()}`)),this.variable=r.content,this.collection=n,this.hash=new Se(i.remaining()),this.templates=[],this.elseTemplates=[];const a=this.liquid.parser.parseStream(e).on("start",(()=>o=this.templates)).on("tag:else",(()=>o=this.elseTemplates)).on("tag:endfor",(()=>a.stop())).on("template",(t=>o.push(t))).on("end",(()=>{throw new Error(`tag ${t.getText()} not closed`)}));a.start()},render:function*(t,e){const i=this.liquid.renderer;let r=Z(yield se(this.collection,t));if(!r.length)return void(yield i.renderTemplates(this.elseTemplates,t,e));const s="continue-"+this.variable+"-"+this.collection.getText();t.push({continue:t.getRegister(s)});const n=yield this.hash.render(t);t.pop();r=(this.liquid.options.orderedFilterParameters?Object.keys(n).filter((t=>Pe.includes(t))):Pe.filter((t=>void 0!==n[t]))).reduce(((t,e)=>{return"offset"===e?(i=t,r=n.offset,i.slice(r)):"limit"===e?function(t,e){return t.slice(0,e)}(t,n.limit):function(t){return[...t].reverse()}(t);var i,r}),r),t.setRegister(s,(n.offset||0)+r.length);const o={forloop:new Me(r.length,this.collection.getText(),this.variable)};t.push(o);for(const s of r){if(o[this.variable]=s,yield i.renderTemplates(this.templates,t,e),e.break){e.break=!1;break}e.continue=!1,o.forloop.next()}t.pop()}};var Ne={parse:function(t,e){const i=new Oe(t.args,this.liquid.options.operatorsTrie);this.variable=function(t){const e=t.readIdentifier().content;if(e)return e;const i=t.readQuoted();if(i)return ne(i)}(i),Lt(this.variable,(()=>`${t.args} not valid identifier`)),this.templates=[];const r=this.liquid.parser.parseStream(e);r.on("tag:endcapture",(()=>r.stop())).on("template",(t=>this.templates.push(t))).on("end",(()=>{throw new Error(`tag ${t.getText()} not closed`)})),r.start()},render:function*(t){const e=this.liquid.renderer,i=yield e.renderTemplates(this.templates,t);t.bottom()[this.variable]=i}};var je,_e={parse:function(t,e){this.cond=new Ee(t.args,this.liquid),this.cases=[],this.elseTemplates=[];let i=[];const r=this.liquid.parser.parseStream(e).on("tag:when",(t=>{i=[];const e=new Oe(t.args,this.liquid.options.operatorsTrie);for(;!e.end();){const t=e.readValue();this.cases.push({val:t,templates:i}),e.readTo(",")}})).on("tag:else",(()=>i=this.elseTemplates)).on("tag:endcase",(()=>r.stop())).on("template",(t=>i.push(t))).on("end",(()=>{throw new Error(`tag ${t.getText()} not closed`)}));r.start()},render:function*(t,e){const i=this.liquid.renderer,r=u(yield this.cond.value(t,t.opts.lenientIf));for(const s of this.cases){if((yield se(s.val,t,t.opts.lenientIf))===r)return void(yield i.renderTemplates(s.templates,t,e))}yield i.renderTemplates(this.elseTemplates,t,e)}},Ae={parse:function(t,e){const i=this.liquid.parser.parseStream(e);i.on("token",(t=>{"endcomment"===t.name&&i.stop()})).on("end",(()=>{throw new Error(`tag ${t.getText()} not closed`)})),i.start()}};!function(t){t[t.OUTPUT=0]="OUTPUT",t[t.STORE=1]="STORE"}(je||(je={}));var Ie=je,ze={parseFilePath:Be,renderFilePath:Ce,parse:function(t){const e=t.args,i=new Oe(e,this.liquid.options.operatorsTrie);for(this.file=this.parseFilePath(i,this.liquid),this.currentFile=t.file;!i.end();){i.skipBlank();const t=i.p,e=i.readIdentifier();if(("with"===e.content||"for"===e.content)&&(i.skipBlank(),":"!==i.peek())){const t=i.readValue();if(t){const r=i.p;let s;"as"===i.readIdentifier().content?s=i.readIdentifier():i.p=r,this[e.content]={value:t,alias:s&&s.content},i.skipBlank(),","===i.peek()&&i.advance();continue}}i.p=t;break}this.hash=new Se(i.remaining())},render:function*(e,i){const{liquid:r,hash:s}=this,n=yield this.renderFilePath(this.file,e,r);Lt(n,(()=>`illegal filename "${n}"`));const o=new ai({},e.opts,{sync:e.sync,globals:e.globals,strictVariables:e.strictVariables}),a=o.bottom();if(t(a,yield s.render(e)),this.with){const{value:t,alias:i}=this.with;a[i||n]=yield se(t,e)}if(this.for){const{value:t,alias:s}=this.for;let l=yield se(t,e);l=Z(l),a.forloop=new Me(l.length,t.getText(),s);for(const t of l){a[s]=t;const e=yield r._parsePartialFile(n,o.sync,this.currentFile);yield r.renderer.renderTemplates(e,o,i),a.forloop.next()}}else{const t=yield r._parsePartialFile(n,o.sync,this.currentFile);yield r.renderer.renderTemplates(t,o,i)}}};function Be(t,e){if(e.options.dynamicPartials){const i=t.readValue();if(void 0===i)throw new TypeError(`illegal argument "${t.input}"`);if("none"===i.getText())return null;if(_t(i)){return Ve(e.parse(ne(i)))}return i}const i=[...t.readFileNameTemplate(e.options)],r=Ve(e.parser.parseTokens(i));return"none"===r?null:r}function Ve(t){return 1===t.length&&$t(t[0].token)?t[0].token.getContent():t}function*Ce(t,e,i){return"string"==typeof t?t:Array.isArray(t)?i.renderer.renderTemplates(t,e):yield se(t,e)}var He={parseFilePath:Be,renderFilePath:Ce,parse:function(t){const e=t.args,i=new Oe(e,this.liquid.options.operatorsTrie);this.file=this.parseFilePath(i,this.liquid),this.currentFile=t.file;const r=i.p;"with"===i.readIdentifier().content?(i.skipBlank(),":"!==i.peek()?this.withVar=i.readValue():i.p=r):i.p=r,this.hash=new Se(i.remaining(),this.liquid.options.jekyllInclude)},render:function*(t,e){const{liquid:i,hash:r,withVar:s}=this,{renderer:n}=i,o=yield this.renderFilePath(this.file,t,i);Lt(o,(()=>`illegal filename "${o}"`));const a=t.saveRegister("blocks","blockMode");t.setRegister("blocks",{}),t.setRegister("blockMode",Ie.OUTPUT);const l=yield r.render(t);s&&(l[o]=yield se(s,t));const h=yield i._parsePartialFile(o,t.sync,this.currentFile);t.push(t.opts.jekyllInclude?{include:l}:l),yield n.renderTemplates(h,t,e),t.pop(),t.restoreRegister(a)}},Ue={parse:function(t){const e=new Oe(t.args,this.liquid.options.operatorsTrie);this.variable=e.readIdentifier().content},render:function(t,e){const i=t.environments;p(i[this.variable])||(i[this.variable]=0),e.write(c(--i[this.variable]))}},Qe={parse:function(t){const e=new Oe(t.args,this.liquid.options.operatorsTrie),i=e.readValue();for(e.skipBlank(),this.candidates=[],i&&(":"===e.peek()?(this.group=i,e.advance()):this.candidates.push(i));!e.end();){const t=e.readValue();t&&this.candidates.push(t),e.readTo(",")}Lt(this.candidates.length,(()=>`empty candidates: ${t.getText()}`))},render:function*(t,e){const i=`cycle:${yield se(this.group,t)}:`+this.candidates.join(","),r=t.getRegister("cycle");let s=r[i];void 0===s&&(s=r[i]=0);const n=this.candidates[s];s=(s+1)%this.candidates.length,r[i]=s;const o=yield se(n,t);e.write(o)}},We={parse:function(t,e){let i;this.branches=[],this.elseTemplates=[],this.liquid.parser.parseStream(e).on("start",(()=>this.branches.push({predicate:new Ee(t.args,this.liquid),templates:i=[]}))).on("tag:elsif",(t=>this.branches.push({predicate:new Ee(t.args,this.liquid),templates:i=[]}))).on("tag:else",(()=>i=this.elseTemplates)).on("tag:endif",(function(){this.stop()})).on("template",(t=>i.push(t))).on("end",(()=>{throw new Error(`tag ${t.getText()} not closed`)})).start()},render:function*(t,e){const i=this.liquid.renderer;for(const{predicate:r,templates:s}of this.branches){if(M(yield r.value(t,t.opts.lenientIf),t))return void(yield i.renderTemplates(s,t,e))}yield i.renderTemplates(this.elseTemplates,t,e)}},Ye={parse:function(t){const e=new Oe(t.args,this.liquid.options.operatorsTrie);this.variable=e.readIdentifier().content},render:function(t,e){const i=t.environments;p(i[this.variable])||(i[this.variable]=0);const r=i[this.variable];i[this.variable]++,e.write(c(r))}},Je={parseFilePath:Be,renderFilePath:Ce,parse:function(t,e){const i=new Oe(t.args,this.liquid.options.operatorsTrie);this.file=this.parseFilePath(i,this.liquid),this.currentFile=t.file,this.hash=new Se(i.remaining()),this.tpls=this.liquid.parser.parseTokens(e)},render:function*(t,e){const{liquid:i,hash:r,file:s}=this,{renderer:n}=i;if(null===s)return t.setRegister("blockMode",Ie.OUTPUT),void(yield n.renderTemplates(this.tpls,t,e));const o=yield this.renderFilePath(this.file,t,i);Lt(o,(()=>`illegal filename "${o}"`));const a=yield i._parseLayoutFile(o,t.sync,this.currentFile);t.setRegister("blockMode",Ie.STORE);const l=yield n.renderTemplates(this.tpls,t),h=t.getRegister("blocks");void 0===h[""]&&(h[""]=(t,e)=>e.write(l)),t.setRegister("blockMode",Ie.OUTPUT),t.push(yield r.render(t)),yield n.renderTemplates(a,t,e),t.pop()}};class Ge extends i{constructor(t=(()=>"")){super(),this.superBlockRender=t}super(){return this.superBlockRender()}}var Xe={parse(t,e){const i=/\w+/.exec(t.args);this.block=i?i[0]:"",this.tpls=[],this.liquid.parser.parseStream(e).on("tag:endblock",(function(){this.stop()})).on("template",(t=>this.tpls.push(t))).on("end",(()=>{throw new Error(`tag ${t.getText()} not closed`)})).start()},*render(t,e){const i=this.getBlockRender(t);t.getRegister("blockMode")===Ie.STORE?t.getRegister("blocks")[this.block]=i:yield i(new Ge,e)},getBlockRender(t){const{liquid:e,tpls:i}=this,r=t.getRegister("blocks")[this.block],s=function*(r,s){t.push({block:r}),yield e.renderer.renderTemplates(i,t,s),t.pop()};return r?(t,e)=>r(new Ge((()=>s(t,e))),e):s}},Ze={parse:function(t,e){this.tokens=[];const i=this.liquid.parser.parseStream(e);i.on("token",(t=>{"endraw"===t.name?i.stop():this.tokens.push(t)})).on("end",(()=>{throw new Error(`tag ${t.getText()} not closed`)})),i.start()},render:function(){return this.tokens.map((t=>t.getText())).join("")}};class Ke extends Me{constructor(t,e,i,r){super(t,i,r),this.length=t,this.cols=e}row(){return Math.floor(this.i/this.cols)+1}col0(){return this.i%this.cols}col(){return this.col0()+1}col_first(){return 0===this.col0()}col_last(){return this.col()===this.cols}}var ti={parse:function(t,e){const i=new Oe(t.args,this.liquid.options.operatorsTrie),r=i.readIdentifier();i.skipBlank();const s=i.readIdentifier();let n;Lt(s&&"in"===s.content,(()=>`illegal tag: ${t.getText()}`)),this.variable=r.content,this.collection=i.readValue(),this.hash=new Se(i.remaining()),this.templates=[];const o=this.liquid.parser.parseStream(e).on("start",(()=>n=this.templates)).on("tag:endtablerow",(()=>o.stop())).on("template",(t=>n.push(t))).on("end",(()=>{throw new Error(`tag ${t.getText()} not closed`)}));o.start()},render:function*(t,e){let i=Z(yield se(this.collection,t));const r=yield this.hash.render(t),s=r.offset||0,n=void 0===r.limit?i.length:r.limit;i=i.slice(s,s+n);const o=r.cols||i.length,a=this.liquid.renderer,l=new Ke(i.length,o,this.collection.getText(),this.variable),h={tablerowloop:l};t.push(h);for(let r=0;r"),e.write(``)),e.write(``),yield a.renderTemplates(this.templates,t,e),e.write("");i.length&&e.write(""),t.pop()}};const ei={assign:De,for:$e,capture:Ne,case:_e,comment:Ae,include:He,render:ze,decrement:Ue,increment:Ye,cycle:Qe,if:We,layout:Je,block:Xe,raw:Ze,tablerow:ti,unless:{parse:function(t,e){let i;this.branches=[],this.elseTemplates=[],this.liquid.parser.parseStream(e).on("start",(()=>this.branches.push({predicate:new Ee(t.args,this.liquid),test:P,templates:i=[]}))).on("tag:elsif",(t=>this.branches.push({predicate:new Ee(t.args,this.liquid),test:M,templates:i=[]}))).on("tag:else",(()=>i=this.elseTemplates)).on("tag:endunless",(function(){this.stop()})).on("template",(t=>i.push(t))).on("end",(()=>{throw new Error(`tag ${t.getText()} not closed`)})).start()},render:function*(t,e){const i=this.liquid.renderer;for(const{predicate:r,test:s,templates:n}of this.branches){if(s(yield r.value(t,t.opts.lenientIf),t))return void(yield i.renderTemplates(n,t,e))}yield i.renderTemplates(this.elseTemplates,t,e)}},break:{render:function(t,e){e.break=!0}},continue:{render:function(t,e){e.continue=!0}},echo:{parse:function(t){this.value=new Ee(t.args,this.liquid)},render:function*(t,e){const i=yield this.value.value(t,!1);e.write(i)}},liquid:{parse:function(t){const e=new Oe(t.args,this.liquid.options.operatorsTrie).readLiquidTagTokens(this.liquid.options);this.tpls=this.liquid.parser.parseTokens(e)},render:function*(t,e){yield this.liquid.renderer.renderTemplates(this.tpls,t,e)}},"#":{parse:function(t,e){if(-1!==t.args.search(/\n\s*[^#\s]/g))throw new Error("every line of an inline comment must start with a '#' character")}}};var ii=Object.freeze({__proto__:null,default:ei});const ri=new Map;m(Dt,((t,e)=>{ri.set(x(e),t)}));const si={root:["."],layouts:["."],partials:["."],relativeReference:!0,jekyllInclude:!1,cache:void 0,extname:"",fs:E,dynamicPartials:!0,jsTruthy:!1,trimTagRight:!1,trimTagLeft:!1,trimOutputRight:!1,trimOutputLeft:!1,greedy:!0,tagDelimiterLeft:"{%",tagDelimiterRight:"%}",outputDelimiterLeft:"{{",outputDelimiterRight:"}}",preserveTimezones:!1,strictFilters:!1,strictVariables:!1,ownPropertyOnly:!1,lenientIf:!1,globals:{},keepOutputType:!1,operators:$,operatorsTrie:I($)};function ni(t){if(t.hasOwnProperty("operators")&&(t.operatorsTrie=I(t.operators)),t.hasOwnProperty("root")&&(t.hasOwnProperty("partials")||(t.partials=t.root),t.hasOwnProperty("layouts")||(t.layouts=t.root)),t.hasOwnProperty("cache")){let e;e="number"==typeof t.cache?t.cache>0?new S(t.cache):void 0:"object"==typeof t.cache?t.cache:t.cache?new S(1024):void 0,t.cache=e}return!(t=Object.assign(Object.assign(Object.assign({},si),t.jekyllInclude?{dynamicPartials:!1}:{}),t)).fs.dirname&&t.relativeReference&&(console.warn("[LiquidJS] `fs.dirname` is required for relativeReference, set relativeReference to `false` to suppress this warning, or provide implementation for `fs.dirname`"),t.relativeReference=!1),t.root=oi(t.root),t.partials=oi(t.partials),t.layouts=oi(t.layouts),t.outputEscape=t.outputEscape&&function(t){if(o(t)){const e=ri.get(t);return Lt(a(e),`filter "${t}" not found`),e}return Lt(a(t),"`outputEscape` need to be of type string or function"),t}(t.outputEscape),t}function oi(t){let e=[];return g(t)&&(e=t),o(t)&&(e=[t]),e}class ai{constructor(t={},e=si,i={}){var r,s;this.scopes=[{}],this.registers={},this.sync=!!i.sync,this.opts=e,this.globals=null!==(r=i.globals)&&void 0!==r?r:e.globals,this.environments=t,this.strictVariables=null!==(s=i.strictVariables)&&void 0!==s?s:this.opts.strictVariables}getRegister(t){return this.registers[t]=this.registers[t]||{}}setRegister(t,e){return this.registers[t]=e}saveRegister(...t){return t.map((t=>[t,this.getRegister(t)]))}restoreRegister(t){return t.forEach((([t,e])=>this.setRegister(t,e)))}getAll(){return[this.globals,this.environments,...this.scopes].reduce(((e,i)=>t(e,i)),{})}get(t){return te(this._get(t))}*_get(t){const e=this.findScope(t[0]);return yield this._getFromScope(e,t)}getFromScope(t,e){return te(this._getFromScope(t,e))}*_getFromScope(t,e){o(e)&&(e=e.split("."));for(let i=0;i=0;e--){const i=this.scopes[e];if(t in i)return i}return t in this.environments?this.environments:this.globals}}function li(t,e,r){if(f(t))return t;if(g(t=d(t))&&e<0)return t[t.length+ +e];const s=function(t,e,i){return i&&!Object.hasOwnProperty.call(t,e)?void 0:t[e]}(t,e,r);return void 0===s&&t instanceof i?t.liquidMethodMissing(e):a(s)?s.call(t):"size"===e?function(t){if(t.hasOwnProperty("size")||void 0!==t.size)return t.size;if(g(t)||o(t))return t.length;if("object"==typeof t)return Object.keys(t).length}(t):"first"===e?function(t){return g(t)?t[0]:t.first}(t):"last"===e?function(t){return g(t)?t[t.length-1]:t.last}(t):s}var hi;!function(t){t.Partials="partials",t.Layouts="layouts",t.Root="root"}(hi||(hi={}));class ci{constructor(t){if(this.options=t,t.relativeReference){const e=t.fs.sep;Lt(e,"`fs.sep` is required for relative reference");const i=new RegExp(["."+e,".."+e,"./","../"].map((t=>t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"))).join("|"));this.shouldLoadRelative=t=>i.test(t)}else this.shouldLoadRelative=t=>!1;this.contains=this.options.fs.contains||(()=>!0)}*lookup(t,e,i,r){const{fs:s}=this.options,n=this.options[e];for(const o of this.candidates(t,n,r,e!==hi.Root))if(i?s.existsSync(o):yield s.exists(o))return o;throw this.lookupError(t,n)}*candidates(t,e,i,r){const{fs:s,extname:n}=this.options;if(this.shouldLoadRelative(t)&&i){const o=s.resolve(this.dirname(i),t,n);for(const t of e)if(!r||this.contains(t,o)){yield o;break}}for(const i of e){const e=s.resolve(i,t,n);r&&!this.contains(i,e)||(yield e)}if(void 0!==s.fallback){const e=s.fallback(t);void 0!==e&&(yield e)}}dirname(t){const e=this.options.fs;return Lt(e.dirname,"`fs.dirname` is required for relative reference"),e.dirname(t)}lookupError(t,e){const i=new Error("ENOENT");return i.message=`ENOENT: Failed to lookup "${t}" in "${e}"`,i.code="ENOENT",i}}class ui{constructor(){this.buffer=""}write(t){this.buffer+=c(t)}}class pi{constructor(){throw this.buffer="",this.stream=null,new Error("streaming not supported in browser")}}class di{constructor(){this.buffer=""}write(t){"string"!=typeof(t=u(t))&&""===this.buffer?this.buffer=t:this.buffer=c(this.buffer)+c(t)}}class fi{renderTemplatesToNodeStream(t,e){const i=new pi;return Promise.resolve().then((()=>Kt(this.renderTemplates(t,e,i)))).then((()=>i.end()),(t=>i.error(t))),i.stream}*renderTemplates(t,e,i){i||(i=e.opts.keepOutputType?new di:new ui);for(const r of t)try{const t=yield r.render(e,i);if(t&&i.write(t),i.break||i.continue)break}catch(t){throw Ot.is(t)?t:new Ot(t,r)}return i.buffer}}class gi{constructor(t){this.token=t}}class mi extends gi{constructor(t,e,i){super(t),this.name=t.name;const r=i.tags.get(t.name);this.impl=Object.create(r),this.impl.liquid=i,this.impl.parse&&this.impl.parse(t,e)}*render(t,e){const i=yield new Se(this.token.args).render(t),r=this.impl;if(a(r.render))return yield r.render(t,e,i)}}class wi extends gi{constructor(t,e){super(t),this.value=new Ee(t.content,e);const i=this.value.filters,r=e.options.outputEscape;i.length&&"raw"===i[i.length-1].name?i.pop():r&&i.push(new Le(toString.call(r),r,[],e))}*render(t,e){const i=yield this.value.value(t,!1);e.write(i)}}class yi extends gi{constructor(t){super(t),this.str=t.getContent()}*render(t,e){e.write(this.str)}}class Ti{constructor(t){this.liquid=t,this.cache=this.liquid.options.cache,this.fs=this.liquid.options.fs,this.parseFile=this.cache?this._parseFileCached:this._parseFile,this.loader=new ci(this.liquid.options)}parse(t,e){const i=new Oe(t,this.liquid.options.operatorsTrie,e).readTopLevelTokens(this.liquid.options);return this.parseTokens(i)}parseTokens(t){let e;const i=[];for(;e=t.shift();)i.push(this.parseToken(e,t));return i}parseToken(t,e){try{return jt(t)?new mi(t,e,this.liquid):Nt(t)?new wi(t,this.liquid):new yi(t)}catch(e){throw new qt(e,t)}}parseStream(t){return new Re(t,((t,e)=>this.parseToken(t,e)))}*_parseFileCached(t,e,i=hi.Root,r){const s=this.cache,n=this.loader.shouldLoadRelative(t)?r+","+t:i+":"+t,o=yield s.read(n);if(o)return o;const a=this._parseFile(t,e,i,r),l=e?yield a:Kt(a);s.write(n,l);try{return yield l}catch(t){throw s.remove(n),t}}*_parseFile(t,e,i=hi.Root,r){const s=yield this.loader.lookup(t,i,e,r);return this.liquid.parse(e?this.fs.readFileSync(s):yield this.fs.readFile(s),s)}}class ki{constructor(){this.impls={}}get(t){const e=this.impls[t];return Lt(e,(()=>`tag "${t}" not found`)),e}set(t,e){this.impls[t]=e}}class vi{constructor(t,e){this.strictFilters=t,this.liquid=e,this.impls={}}get(t){const e=this.impls[t];return Lt(e||!this.strictFilters,(()=>`undefined filter: ${t}`)),e}set(t,e){this.impls[t]=e}create(t,e){return new Le(t,this.get(t),e,this.liquid)}}const bi="9.42.0";class xi{constructor(t={}){this.options=ni(t),this.parser=new Ti(this),this.renderer=new fi,this.filters=new vi(this.options.strictFilters,this),this.tags=new ki,m(ei,((t,e)=>this.registerTag(x(e),t))),m(Dt,((t,e)=>this.registerFilter(x(e),t)))}parse(t,e){return this.parser.parse(t,e)}_render(t,e,i){const r=new ai(e,this.options,i);return this.renderer.renderTemplates(t,r)}render(t,i,r){return e(this,void 0,void 0,(function*(){return Kt(this._render(t,i,Object.assign(Object.assign({},r),{sync:!1})))}))}renderSync(t,e,i){return te(this._render(t,e,Object.assign(Object.assign({},i),{sync:!0})))}renderToNodeStream(t,e,i={}){const r=new ai(e,this.options,i);return this.renderer.renderTemplatesToNodeStream(t,r)}_parseAndRender(t,e,i){const r=this.parse(t);return this._render(r,e,i)}parseAndRender(t,i,r){return e(this,void 0,void 0,(function*(){return Kt(this._parseAndRender(t,i,Object.assign(Object.assign({},r),{sync:!1})))}))}parseAndRenderSync(t,e,i){return te(this._parseAndRender(t,e,Object.assign(Object.assign({},i),{sync:!0})))}_parsePartialFile(t,e,i){return this.parser.parseFile(t,e,hi.Partials,i)}_parseLayoutFile(t,e,i){return this.parser.parseFile(t,e,hi.Layouts,i)}parseFile(t){return e(this,void 0,void 0,(function*(){return Kt(this.parser.parseFile(t,!1))}))}parseFileSync(t){return te(this.parser.parseFile(t,!0))}renderFile(t,i,r){return e(this,void 0,void 0,(function*(){const e=yield this.parseFile(t);return this.render(e,i,r)}))}renderFileSync(t,e,i){const r=this.parseFileSync(t);return this.renderSync(r,e,i)}renderFileToNodeStream(t,i,r){return e(this,void 0,void 0,(function*(){const e=yield this.parseFile(t);return this.renderToNodeStream(e,i,r)}))}_evalValue(t,e){const i=new Ee(t,this),r=e instanceof ai?e:new ai(e,this.options);return i.value(r,!1)}evalValue(t,i){return e(this,void 0,void 0,(function*(){return Kt(this._evalValue(t,i))}))}evalValueSync(t,e){return te(this._evalValue(t,e))}registerFilter(t,e){this.filters.set(t,e)}registerTag(t,e){this.tags.set(t,e)}plugin(t){return t.call(this,xi)}express(){const t=this;let e=!0;return function(i,r,s){if(e){e=!1;const i=oi(this.root);t.options.root.unshift(...i),t.options.layouts.unshift(...i),t.options.partials.unshift(...i)}t.renderFile(i,r).then((t=>s(null,t)),s)}}}export{St as AssertionError,ai as Context,i as Drop,ie as Expression,Se as Hash,Rt as InternalUndefinedVariableError,xi as Liquid,bt as LiquidError,qt as ParseError,Re as ParseStream,Ot as RenderError,Fe as TagToken,kt as TimezoneDate,le as Token,Et as TokenKind,xt as TokenizationError,Oe as Tokenizer,Ht as TypeGuards,Ft as UndefinedVariableError,Ee as Value,se as _evalToken,Lt as assert,I as createTrie,$ as defaultOperators,si as defaultOptions,ne as evalQuotedToken,re as evalToken,Dt as filters,P as isFalsy,M as isTruthy,ii as tags,Kt as toPromise,ee as toThenable,u as toValue,te as toValueSync,bi as version};export default null; //# sourceMappingURL=/sm/84dd987c4ab23284a4b6874933aa77580fdff46fec9773127d7b183f9392a635.map