@nosto/autocomplete
Version:
Library designed to simplify the implementation of search autocomplete functionality
14 lines • 95.3 kB
JavaScript
class A{constructor(e,n,s,i,r){this.kind=e,this.input=n,this.begin=s,this.end=i,this.file=r}getText(){return this.input.slice(this.begin,this.end)}getPosition(){let[e,n]=[1,1];for(let s=0;s<this.begin;s++)this.input[s]===`
`?(e++,n=1):n++;return[e,n]}size(){return this.end-this.begin}}class Y{liquidMethodMissing(e,n){}}const Hn=Object.prototype.toString,ft=String.prototype.toLowerCase,Pe=Object.hasOwnProperty;function p(t){return typeof t=="string"}function T(t){return typeof t=="function"}function Un(t){return t&&T(t.then)}function fe(t){return t&&T(t.next)&&T(t.throw)&&T(t.return)}function Bn(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function d(t){return t=g(t),p(t)?t:z(t)?"":x(t)?t.map(e=>d(e)).join(""):String(t)}function ce(t){return t=g(t),x(t)?t:p(t)&&t.length>0?[t]:Wn(t)?Array.from(t):ge(t)?Object.keys(t).map(e=>[e,t[e]]):[]}function _(t){return t=g(t),z(t)?[]:x(t)?t:[t]}function g(t){return t instanceof Y&&T(t.valueOf)?t.valueOf():t}function qe(t){return+g(t)||0}function pe(t){return typeof t=="number"}function pt(t){return t&&T(t.toLiquid)?pt(t.toLiquid()):t}function z(t){return t==null}function Jn(t){return t===void 0}function x(t){return Hn.call(t)==="[object Array]"}function gt(t){return t&&pe(t.length)}function Wn(t){return ge(t)&&Symbol.iterator in t}function mt(t,e){t=t||{};for(const n in t)if(Pe.call(t,n)&&e(t[n],n,t)===!1)break;return t}function yt(t){return t[t.length-1]}function ge(t){const e=typeof t;return t!==null&&(e==="object"||e==="function")}function wt(t,e,n=1){const s=[];for(let i=t;i<e;i+=n)s.push(i);return s}function ue(t,e,n=" "){return bt(t,e,n,(s,i)=>i+s)}function Yn(t,e,n=" "){return bt(t,e,n,(s,i)=>s+i)}function bt(t,e,n,s){t=String(t);let i=e-t.length;for(;i-- >0;)t=s(t,n);return t}function vt(t){return t}function Qn(t){return[...t].some(n=>n>="a"&&n<="z")?t.toUpperCase():t.toLowerCase()}function Zn(t,e){return t.length>e?t.slice(0,e-3)+"...":t}function kt(t,e){return t==null&&e==null?0:t==null?1:e==null||(t=ft.call(t),e=ft.call(e),t<e)?-1:t>e?1:0}function me(t){return function(...e){return t.call(this,...e.map(g))}}function q(t){return function(...e){return t.call(this,...e.map(qe))}}function je(t){return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}function*ye(t){const e=new Set;for(const n of t){const s=JSON.stringify(n);e.has(s)||(e.add(s),yield n)}}const Tt="__liquidClass__";class Q extends Error{constructor(e,n){super(typeof e=="string"?e:e.message),this.context="",typeof e!="string"&&Object.defineProperty(this,"originalError",{value:e,enumerable:!1}),Object.defineProperty(this,"token",{value:n,enumerable:!1}),Object.defineProperty(this,Tt,{value:"LiquidError",enumerable:!1})}update(){Object.defineProperty(this,"context",{value:ss(this.token),enumerable:!1}),this.message=is(this.message,this.token),this.stack=this.message+`
`+this.context+`
`+this.stack,this.originalError&&(this.stack+=`
From `+this.originalError.stack)}static is(e){return e?.[Tt]==="LiquidError"}}class Gn extends Q{constructor(e,n){super(e,n),this.name="TokenizationError",super.update()}}class Xn extends Q{constructor(e,n){super(e,n),this.name="ParseError",this.message=e.message,super.update()}}class Kn extends Q{constructor(e,n){super(e,n.token),this.name="RenderError",this.message=e.message,super.update()}static is(e){return e.name==="RenderError"}}class St extends Q{constructor(e){super(e[0],e[0].token),this.errors=e,this.name="LiquidErrors";const n=e.length>1?"s":"";this.message=`${e.length} error${n} found`,super.update()}static is(e){return e.name==="LiquidErrors"}}class es extends Q{constructor(e,n){super(e,n),this.name="UndefinedVariableError",this.message=e.message,super.update()}}class ts extends Error{constructor(e){super(`undefined variable: ${e}`),this.name="InternalUndefinedVariableError",this.variableName=e}}class ns extends Error{constructor(e){super(e),this.name="AssertionError",this.message=e+""}}function ss(t){const[e,n]=t.getPosition(),s=t.input.split(`
`),i=Math.max(e-2,1),r=Math.min(e+3,s.length);return wt(i,r+1).map(a=>{const c=a===e?">> ":" ",u=ue(String(a),String(r).length);let l=`${c}${u}| `;const h=a===e?`
`+ue("^",n+l.length):"";return l+=s[a-1],l+=h,l}).join(`
`)}function is(t,e){e.file&&(t+=`, file:${e.file}`);const[n,s]=e.getPosition();return t+=`, line:${n}, col:${s}`,t}const y=[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],rs=1,ie=4,_t=8,xt=16,os=32,as=64,ls=128;function we(t){const e=t.charCodeAt(0);return e>=128?!y[e]:!!(y[e]&rs)}y[160]=y[5760]=y[6158]=y[8192]=y[8193]=y[8194]=y[8195]=y[8196]=y[8197]=y[8198]=y[8199]=y[8200]=y[8201]=y[8202]=y[8232]=y[8233]=y[8239]=y[8287]=y[12288]=ie,y[8220]=y[8221]=ls;function L(t,e){if(!t){const n=typeof e=="function"?e():e||`expect ${t} to be true`;throw new ns(n)}}function be(t,e=`unexpected ${JSON.stringify(t)}`){L(!t,e)}class cs extends Y{equals(e){return z(g(e))}gt(){return!1}geq(){return!1}lt(){return!1}leq(){return!1}valueOf(){return null}}class le extends Y{equals(e){return e instanceof le?!1:(e=g(e),p(e)||x(e)?e.length===0:ge(e)?Object.keys(e).length===0:!1)}gt(){return!1}geq(){return!1}lt(){return!1}leq(){return!1}valueOf(){return""}static is(e){return e instanceof le}}class ct extends le{equals(e){return e===!1||z(g(e))?!0:p(e)?/^\s*$/.test(e):super.equals(e)}static is(e){return e instanceof ct}}class Me extends Y{constructor(e,n,s){super(),this.i=0,this.length=e,this.name=`${s}-${n}`}next(){this.i++}index0(){return this.i}index(){return this.i+1}first(){return this.i===0}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)}}class Lt{constructor(){this.buffer=""}write(e){this.buffer+=d(e)}}class us{constructor(){throw this.buffer="",this.stream=null,new Error("streaming not supported in browser")}}class hs{constructor(){this.buffer=""}write(e){e=g(e),typeof e!="string"&&this.buffer===""?this.buffer=e:this.buffer=d(this.buffer)+d(e)}}class Ot extends Y{constructor(e=()=>""){super(),this.superBlockRender=e}*super(){const e=new Lt;return yield this.superBlockRender(e),e.buffer}}function j(t){return t&&T(t.equals)&&T(t.gt)&&T(t.geq)&&T(t.lt)&&T(t.leq)}const Ft=new cs,Et={true:!0,false:!1,nil:Ft,null:Ft,empty:new le,blank:new ct};function At(t){const e={};for(const[n,s]of Object.entries(t)){let i=e;for(let r=0;r<n.length;r++){const o=n[r];i[o]=i[o]||{},r===n.length-1&&we(n[r])&&(i[o].needBoundary=!0),i=i[o]}i.data=s,i.end=!0}return e}var ve=function(){return ve=Object.assign||function(e){for(var n,s=1,i=arguments.length;s<i;s++){n=arguments[s];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ve.apply(this,arguments)};function S(t,e,n,s){function i(r){return r instanceof n?r:new n(function(o){o(r)})}return new(n||(n=Promise))(function(r,o){function a(l){try{u(s.next(l))}catch(h){o(h)}}function c(l){try{u(s.throw(l))}catch(h){o(h)}}function u(l){l.done?r(l.value):i(l.value).then(a,c)}u((s=s.apply(t,[])).next())})}function $(t){return S(this,void 0,void 0,function*(){if(!fe(t))return t;let e,n=!1,s="next";do{const i=t[s](e);n=i.done,e=i.value,s="next";try{fe(e)&&(e=$(e)),Un(e)&&(e=yield e)}catch(r){s="throw",e=r}}while(!n);return e})}function V(t){if(!fe(t))return t;let e,n=!1,s="next";do{const i=t[s](e);if(n=i.done,e=i.value,s="next",fe(e))try{e=V(e)}catch(r){s="throw",e=r}}while(!n);return e}const ds=/%([-_0^#:]+)?(\d+)?([EO])?(.)/;function fs(t){return[31,ps(t)?29:28,31,30,31,30,31,31,30,31,30,31]}function zt(t){let e=0;for(let n=0;n<t.getMonth();++n)e+=fs(t)[n];return e+t.getDate()}function Rt(t,e){const n=zt(t)+(e-t.getDay()),i=7-new Date(t.getFullYear(),0,1).getDay()+e;return String(Math.floor((n-i)/7)+1)}function ps(t){const e=t.getFullYear();return!!((e&3)===0&&(e%100||e%400===0&&e))}function gs(t){const e=t.getDate();if([11,12,13].includes(e))return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}function ms(t){return parseInt(t.getFullYear().toString().substring(0,2),10)}const ys={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},ws=new Set("aAbBceklpP");function Dt(t,e){const n=Math.abs(t.getTimezoneOffset()),s=Math.floor(n/60),i=n%60;return(t.getTimezoneOffset()>0?"-":"+")+ue(s,2,"0")+(e.flags[":"]?":":"")+ue(i,2,"0")}const Ie={a:t=>t.getShortWeekdayName(),A:t=>t.getLongWeekdayName(),b:t=>t.getShortMonthName(),B:t=>t.getLongMonthName(),c:t=>t.toLocaleString(),C:t=>ms(t),d:t=>t.getDate(),e:t=>t.getDate(),H:t=>t.getHours(),I:t=>String(t.getHours()%12||12),j:t=>zt(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 n=Number(e.width)||9,s=String(t.getMilliseconds()).slice(0,n);return Yn(s,n,"0")},p:t=>t.getHours()<12?"AM":"PM",P:t=>t.getHours()<12?"am":"pm",q:t=>gs(t),s:t=>Math.round(t.getTime()/1e3),S:t=>t.getSeconds(),u:t=>t.getDay()||7,U:t=>Rt(t,0),w:t=>t.getDay(),W:t=>Rt(t,1),x:t=>t.toLocaleDateString(),X:t=>t.toLocaleTimeString(),y:t=>t.getFullYear().toString().slice(2,4),Y:t=>t.getFullYear(),z:Dt,Z:(t,e)=>t.getTimeZoneName()||Dt(t,e),t:()=>" ",n:()=>`
`,"%":()=>"%"};Ie.h=Ie.b;function ke(t,e){let n="",s=e,i;for(;i=ds.exec(s);)n+=s.slice(0,i.index),s=s.slice(i.index+i[0].length),n+=bs(t,i);return n+s}function bs(t,e){const[n,s="",i,r,o]=e,a=Ie[o];if(!a)return n;const c={};for(const f of s)c[f]=!0;let u=String(a(t,{flags:c,width:i,modifier:r})),l=ws.has(o)?" ":"0",h=i||ys[o]||0;return c["^"]?u=u.toUpperCase():c["#"]&&(u=Qn(u)),c._?l=" ":c[0]&&(l="0"),c["-"]&&(h=0),ue(u,h,l)}function Nt(){return typeof Intl<"u"?Intl.DateTimeFormat:void 0}const vs=6e4,ks=/([zZ]|([+-])(\d{2}):?(\d{2}))$/,Ct=["January","February","March","April","May","June","July","August","September","October","November","December"],Ts=Ct.map(t=>t.slice(0,3)),Pt=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Ss=Pt.map(t=>t.slice(0,3));class P{constructor(e,n,s){this.locale=n,this.DateTimeFormat=Nt(),this.date=new Date(e),this.timezoneFixed=s!==void 0,s===void 0&&(s=this.date.getTimezoneOffset()),this.timezoneOffset=p(s)?P.getTimezoneOffset(s,this.date):s,this.timezoneName=p(s)?s:"";const i=(this.date.getTimezoneOffset()-this.timezoneOffset)*vs,r=this.date.getTime()+i;this.displayDate=new Date(r)}getTime(){return this.displayDate.getTime()}getMilliseconds(){return this.displayDate.getMilliseconds()}getSeconds(){return this.displayDate.getSeconds()}getMinutes(){return this.displayDate.getMinutes()}getHours(){return this.displayDate.getHours()}getDay(){return this.displayDate.getDay()}getDate(){return this.displayDate.getDate()}getMonth(){return this.displayDate.getMonth()}getFullYear(){return this.displayDate.getFullYear()}toLocaleString(e,n){return n?.timeZone?this.date.toLocaleString(e,n):this.displayDate.toLocaleString(e,n)}toLocaleTimeString(e){return this.displayDate.toLocaleTimeString(e)}toLocaleDateString(e){return this.displayDate.toLocaleDateString(e)}getTimezoneOffset(){return this.timezoneOffset}getTimeZoneName(){if(this.timezoneFixed)return this.timezoneName;if(this.DateTimeFormat)return this.DateTimeFormat().resolvedOptions().timeZone}getLongMonthName(){var e;return(e=this.format({month:"long"}))!==null&&e!==void 0?e:Ct[this.getMonth()]}getShortMonthName(){var e;return(e=this.format({month:"short"}))!==null&&e!==void 0?e:Ts[this.getMonth()]}getLongWeekdayName(){var e;return(e=this.format({weekday:"long"}))!==null&&e!==void 0?e:Pt[this.displayDate.getDay()]}getShortWeekdayName(){var e;return(e=this.format({weekday:"short"}))!==null&&e!==void 0?e:Ss[this.displayDate.getDay()]}valid(){return!isNaN(this.getTime())}format(e){return this.DateTimeFormat&&this.DateTimeFormat(this.locale,e).format(this.displayDate)}static createDateFixedToTimezone(e,n){const s=e.match(ks);if(s&&s[1]==="Z")return new P(+new Date(e),n,0);if(s&&s[2]&&s[3]&&s[4]){const[,,i,r,o]=s,a=(i==="+"?-1:1)*(parseInt(r,10)*60+parseInt(o,10));return new P(+new Date(e),n,a)}return new P(e,n)}static getTimezoneOffset(e,n){const s=n.toLocaleString("en-US",{timeZone:e}),i=n.toLocaleString("en-US",{timeZone:"UTC"}),r=new Date(s);return(+new Date(i)-+r)/(60*1e3)}}class $e{constructor(e,n){this.base=0,this.message=`${e} limit exceeded`,this.limit=n}use(e){e=+e||0,L(this.base+e<=this.limit,this.message),this.base+=e}check(e){e=+e||0,L(e<=this.limit,this.message)}}class Ve extends A{constructor(e,[n,s],i,r,o,a,c,u){super(e,i,r,o,u),this.trimLeft=!1,this.trimRight=!1;const l=i[n]==="-",h=i[s-1]==="-";let f=l?n+1:n,w=h?s-1:s;for(;f<w&&y[i.charCodeAt(f)]&ie;)f++;for(;w>f&&y[i.charCodeAt(w-1)]&ie;)w--;this.contentRange=[f,w],this.trimLeft=l||a,this.trimRight=h||c}get content(){return this.input.slice(this.contentRange[0],this.contentRange[1])}}class qt extends Ve{constructor(e,n,s,i,r){const{trimTagLeft:o,trimTagRight:a,tagDelimiterLeft:c,tagDelimiterRight:u}=i,[l,h]=[n+c.length,s-u.length];super(b.Tag,[l,h],e,n,s,o,a,r),this.tokenizer=new M(e,i.operators,r,this.contentRange),this.name=this.tokenizer.readTagName(),this.tokenizer.assert(this.name,"illegal tag syntax, tag name expected"),this.tokenizer.skipBlank(),this.args=this.tokenizer.input.slice(this.tokenizer.p,this.contentRange[1])}}class _s extends Ve{constructor(e,n,s,i,r){const{trimOutputLeft:o,trimOutputRight:a,outputDelimiterLeft:c,outputDelimiterRight:u}=i,l=[n+c.length,s-u.length];super(b.Output,l,e,n,s,o,a,r)}}class jt extends A{constructor(e,n,s,i){super(b.HTML,e,n,s,i),this.input=e,this.begin=n,this.end=s,this.file=i,this.trimLeft=0,this.trimRight=0}getContent(){return this.input.slice(this.begin+this.trimLeft,this.end-this.trimRight)}}class xs extends A{constructor(e,n,s,i){super(b.Number,e,n,s,i),this.input=e,this.begin=n,this.end=s,this.file=i,this.content=Number(this.getText())}}class He extends A{constructor(e,n,s,i){super(b.Word,e,n,s,i),this.input=e,this.begin=n,this.end=s,this.file=i,this.content=this.getText()}}class Ls extends A{constructor(e,n,s,i){super(b.Literal,e,n,s,i),this.input=e,this.begin=n,this.end=s,this.file=i,this.literal=this.getText(),this.content=Et[this.literal]}}const Mt={"==":2,"!=":2,">":2,"<":2,">=":2,"<=":2,contains:2,not:1,and:0,or:0},Os={"==":0,"!=":0,">":0,"<":0,">=":0,"<=":0,contains:0,not:1,and:0,or:0};class Fs extends A{constructor(e,n,s,i){super(b.Operator,e,n,s,i),this.input=e,this.begin=n,this.end=s,this.file=i,this.operator=this.getText()}getPrecedence(){const e=this.getText();return e in Mt?Mt[e]:1}}class It extends A{constructor(e,n,s,i,r,o){super(b.PropertyAccess,s,i,r,o),this.variable=e,this.props=n}}class $t extends A{constructor(e,n,s,i,r,o){super(b.Filter,s,i,r,o),this.name=e,this.args=n}}class Es extends A{constructor(e,n,s,i,r,o){super(b.Hash,e,n,s,o),this.input=e,this.begin=n,this.end=s,this.name=i,this.value=r,this.file=o}}const As=/[\da-fA-F]/,Vt=/[0-7]/,Ht={b:"\b",f:"\f",n:`
`,r:"\r",t:" ",v:"\v"};function Ut(t){const e=t.charCodeAt(0);return e>=97?e-87:e>=65?e-55:e-48}function zs(t){let e="";for(let n=1;n<t.length-1;n++){if(t[n]!=="\\"){e+=t[n];continue}if(Ht[t[n+1]]!==void 0)e+=Ht[t[++n]];else if(t[n+1]==="u"){let s=0,i=n+2;for(;i<=n+5&&As.test(t[i]);)s=s*16+Ut(t[i++]);n=i-1,e+=String.fromCharCode(s)}else if(!Vt.test(t[n+1]))e+=t[++n];else{let s=n+1,i=0;for(;s<=n+3&&Vt.test(t[s]);)i=i*8+Ut(t[s++]);n=s-1,e+=String.fromCharCode(i)}}return e}class Rs extends A{constructor(e,n,s,i){super(b.Quoted,e,n,s,i),this.input=e,this.begin=n,this.end=s,this.file=i,this.content=zs(this.getText())}}class Ds extends A{constructor(e,n,s,i,r,o){super(b.Range,e,n,s,o),this.input=e,this.begin=n,this.end=s,this.lhs=i,this.rhs=r,this.file=o}}class Ns extends Ve{constructor(e,n,s,i,r){super(b.Tag,[n,s],e,n,s,!1,!1,r),this.tokenizer=new M(e,i.operators,r,this.contentRange),this.name=this.tokenizer.readTagName(),this.tokenizer.assert(this.name,"illegal liquid tag syntax"),this.tokenizer.skipBlank()}get args(){return this.tokenizer.input.slice(this.tokenizer.p,this.contentRange[1])}}class Cs extends A{constructor(e,n,s,i,r,o){super(b.FilteredValue,s,i,r,o),this.initial=e,this.filters=n,this.input=s,this.begin=i,this.end=r,this.file=o}}const Ps={now:()=>Date.now()};function Bt(){return typeof global=="object"&&global.performance||typeof window=="object"&&window.performance||Ps}class qs{renderTemplatesToNodeStream(e,n){const s=new us;return Promise.resolve().then(()=>$(this.renderTemplates(e,n,s))).then(()=>s.end(),i=>s.error(i)),s.stream}*renderTemplates(e,n,s){s||(s=n.opts.keepOutputType?new hs:new Lt);const i=[];for(const r of e){n.renderLimit.check(Bt().now());try{const o=yield r.render(n,s);if(o&&s.write(o),n.breakCalled||n.continueCalled)break}catch(o){const a=Q.is(o)?o:new Kn(o,r);if(n.opts.catchAllErrors)i.push(a);else throw a}}if(i.length)throw new St(i);return s.buffer}}class js{constructor(e){this.postfix=[...Vs(e)]}*evaluate(e,n){L(e,"unable to evaluate: context not defined");const s=[];for(const i of this.postfix)if(sn(i)){const r=s.pop();let o;if(Os[i.operator]===1)o=yield e.opts.operators[i.operator](r,e);else{const a=s.pop();o=yield e.opts.operators[i.operator](a,r,e)}s.push(o)}else s.push(yield k(i,e,n));return s[0]}valid(){return!!this.postfix.length}}function*k(t,e,n=!1){if(t){if("content"in t)return t.content;if(Le(t))return yield Ms(t,e,n);if(an(t))return yield $s(t,e)}}function*Ms(t,e,n){const s=[];for(const i of t.props)s.push(yield k(i,e,!1));try{if(t.variable){const i=yield k(t.variable,e,n);return yield e._getFromScope(i,s)}else return yield e._get(s)}catch(i){if(n&&i.name==="InternalUndefinedVariableError")return null;throw new es(i,t)}}function Is(t){return t.content}function*$s(t,e){const n=yield k(t.lhs,e),s=yield k(t.rhs,e);return e.memoryLimit.use(s-n+1),wt(+n,+s+1)}function*Vs(t){const e=[];for(const n of t)if(sn(n)){for(;e.length&&e[e.length-1].getPrecedence()>n.getPrecedence();)yield e.pop();e.push(n)}else yield n;for(;e.length;)yield e.pop()}function Z(t,e){return!Te(t,e)}function Te(t,e){return t=g(t),e.opts.jsTruthy?!t:t===!1||t===void 0||t===null}const Hs={"==":H,"!=":(t,e)=>!H(t,e),">":(t,e)=>j(t)?t.gt(e):j(e)?e.lt(t):g(t)>g(e),"<":(t,e)=>j(t)?t.lt(e):j(e)?e.gt(t):g(t)<g(e),">=":(t,e)=>j(t)?t.geq(e):j(e)?e.leq(t):g(t)>=g(e),"<=":(t,e)=>j(t)?t.leq(e):j(e)?e.geq(t):g(t)<=g(e),contains:(t,e)=>(t=g(t),x(t)?t.some(n=>H(n,e)):T(t?.indexOf)?t.indexOf(g(e))>-1:!1),not:(t,e)=>Te(g(t),e),and:(t,e,n)=>Z(g(t),n)&&Z(g(e),n),or:(t,e,n)=>Z(g(t),n)||Z(g(e),n)};function H(t,e){return j(t)?t.equals(e):j(e)?e.equals(t):(t=g(t),e=g(e),x(t)?x(e)&&Us(t,e):t===e)}function Us(t,e){return t.length!==e.length?!1:!t.some((n,s)=>!H(n,e[s]))}function Bs(t,e){return t.some(n=>H(n,e))}class Ue{constructor(e,n,s,i){this.key=e,this.value=n,this.next=s,this.prev=i}}class Jt{constructor(e,n=0){this.limit=e,this.size=n,this.cache={},this.head=new Ue("HEAD",null,null,null),this.tail=new Ue("TAIL",null,null,null),this.head.next=this.tail,this.tail.prev=this.head}write(e,n){if(this.cache[e])this.cache[e].value=n;else{const s=new Ue(e,n,this.head.next,this.head);this.head.next.prev=s,this.head.next=s,this.cache[e]=s,this.size++,this.ensureLimit()}}read(e){if(!this.cache[e])return;const{value:n}=this.cache[e];return this.remove(e),this.write(e,n),n}remove(e){const n=this.cache[e];n.prev.next=n.next,n.next.prev=n.prev,delete this.cache[e],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 Wt(t,e){const n=document.createElement("base");n.href=t;const s=document.getElementsByTagName("head")[0];s.insertBefore(n,s.firstChild);const i=document.createElement("a");i.href=e;const r=i.href;return s.removeChild(n),r}function Js(t,e,n){return t.length&&yt(t)!=="/"&&(t+="/"),Wt(t,e).replace(/^(\w+:\/\/[^/]+)(\/[^?]+)/,(i,r,o)=>{const a=o.split("/").pop();return/\.\w+$/.test(a)?i:r+o+n})}function Ws(t){return S(this,void 0,void 0,function*(){return new Promise((e,n)=>{const s=new XMLHttpRequest;s.onload=()=>{s.status>=200&&s.status<300?e(s.responseText):n(new Error(s.statusText))},s.onerror=()=>{n(new Error("An error occurred whilst receiving the response."))},s.open("GET",t),s.send()})})}function Ys(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}function Qs(t){return S(this,void 0,void 0,function*(){return!0})}function Zs(t){return!0}function Gs(t){return Wt(t,".")}const Xs="/";var Ks=Object.freeze({__proto__:null,resolve:Js,readFile:Ws,readFileSync:Ys,exists:Qs,existsSync:Zs,dirname:Gs,sep:Xs});function ei(t,e,...n){return t=g(t),x(t)||p(t)?t.length?t:e:t===!1&&new Map(n).get("allow_false")?!1:Te(t,this.context)?e:t}function Yt(t,e=0){return JSON.stringify(t,null,e)}function ti(t,e=0){const n=[];return JSON.stringify(t,function(s,i){if(typeof i!="object"||i===null)return i;for(;n.length>0&&n[n.length-1]!==this;)n.pop();return n.includes(i)?"[Circular]":(n.push(i),i)},e)}function ni(t){return Number(t)}const si={raw:!0,handler:vt};var Qt={default:ei,raw:si,jsonify:Yt,to_integer:ni,json:Yt,inspect:ti};const ii={"&":"&","<":"<",">":">",'"':""","'":"'"},ri={"&":"&","<":"<",">":">",""":'"',"'":"'"};function Se(t){return t=d(t),this.context.memoryLimit.use(t.length),t.replace(/&|<|>|"|'/g,e=>ii[e])}function oi(t){return Se.call(this,t)}function ai(t){return t=d(t),this.context.memoryLimit.use(t.length),t.replace(/&(amp|lt|gt|#34|#39);/g,e=>ri[e])}function li(t){return Se.call(this,ai.call(this,t))}function ci(t){const e=d(t);return this.context.memoryLimit.use(e.length),e.replace(/\r?\n/gm,`<br />
`)}function ui(t){const e=d(t);return this.context.memoryLimit.use(e.length),e.replace(/<script[\s\S]*?<\/script>|<style[\s\S]*?<\/style>|<.*?>|<!--[\s\S]*?-->/g,"")}var hi=Object.freeze({__proto__:null,escape:Se,xml_escape:oi,escape_once:li,newline_to_br:ci,strip_html:ui});class di{constructor(e){this.mapping=e,this.sep="/"}exists(e){return S(this,void 0,void 0,function*(){return this.existsSync(e)})}existsSync(e){return!z(this.mapping[e])}readFile(e){return S(this,void 0,void 0,function*(){return this.readFileSync(e)})}readFileSync(e){const n=this.mapping[e];if(z(n))throw new Error(`ENOENT: ${e}`);return n}dirname(e){const n=e.split(this.sep);return n.pop(),n.join(this.sep)}resolve(e,n,s){if(n+=s,e===".")return n;const i=e.split(/\/+/);for(const r of n.split(this.sep))r==="."||r===""||(r===".."?(i.length>1||i[0]!=="")&&i.pop():i.push(r));return i.join(this.sep)}}const re={root:["."],layouts:["."],partials:["."],relativeReference:!0,jekyllInclude:!1,keyValueSeparator:":",cache:void 0,extname:"",fs:Ks,dynamicPartials:!0,jsTruthy:!1,dateFormat:"%A, %B %-e, %Y at %-l:%M %P %z",locale:"",trimTagRight:!1,trimTagLeft:!1,trimOutputRight:!1,trimOutputLeft:!1,greedy:!0,tagDelimiterLeft:"{%",tagDelimiterRight:"%}",outputDelimiterLeft:"{{",outputDelimiterRight:"}}",preserveTimezones:!1,strictFilters:!1,strictVariables:!1,ownPropertyOnly:!0,lenientIf:!1,globals:{},keepOutputType:!1,operators:Hs,memoryLimit:1/0,parseLimit:1/0,renderLimit:1/0};function fi(t){var e,n;if(t.hasOwnProperty("root")&&(t.hasOwnProperty("partials")||(t.partials=t.root),t.hasOwnProperty("layouts")||(t.layouts=t.root)),t.hasOwnProperty("cache")){let s;typeof t.cache=="number"?s=t.cache>0?new Jt(t.cache):void 0:typeof t.cache=="object"?s=t.cache:s=t.cache?new Jt(1024):void 0,t.cache=s}return t=Object.assign(Object.assign(Object.assign({},re),t.jekyllInclude?{dynamicPartials:!1}:{}),t),(!t.fs.dirname||!t.fs.sep)&&t.relativeReference&&(console.warn("[LiquidJS] `fs.dirname` and `fs.sep` are required for relativeReference, set relativeReference to `false` to suppress this warning"),t.relativeReference=!1),t.root=_e(t.root),t.partials=_e(t.partials),t.layouts=_e(t.layouts),t.outputEscape=t.outputEscape&&pi(t.outputEscape),t.locale||(t.locale=(n=(e=Nt())===null||e===void 0?void 0:e().resolvedOptions().locale)!==null&&n!==void 0?n:"en-US"),t.templates&&(t.fs=new di(t.templates),t.relativeReference=!0,t.root=t.partials=t.layouts="."),t}function pi(t){return t==="escape"?Se:t==="json"?Qt.json:(L(T(t),"`outputEscape` need to be of type string or function"),t)}function _e(t){let e=[];return x(t)&&(e=t),p(t)&&(e=[t]),e}function gi(t,e){let n=!1;for(let s=0;s<t.length;s++){const i=t[s];_i(i)&&(!n&&i.trimLeft&&mi(t[s-1],e.greedy),K(i)&&(i.name==="raw"?n=!0:i.name==="endraw"&&(n=!1)),!n&&i.trimRight&&yi(t[s+1],e.greedy))}}function mi(t,e){if(!t||!Ye(t))return;const n=e?ie:xt;for(;y[t.input.charCodeAt(t.end-1-t.trimRight)]&n;)t.trimRight++}function yi(t,e){if(!t||!Ye(t))return;const n=e?ie:xt;for(;y[t.input.charCodeAt(t.begin+t.trimLeft)]&n;)t.trimLeft++;t.input.charAt(t.begin+t.trimLeft)===`
`&&t.trimLeft++}class M{constructor(e,n=re.operators,s,i){this.input=e,this.file=s,this.rawBeginAt=-1,this.p=i?i[0]:0,this.N=i?i[1]:e.length,this.opTrie=At(n),this.literalTrie=At(Et)}readExpression(){return new js(this.readExpressionTokens())}*readExpressionTokens(){for(;this.p<this.N;){const e=this.readOperator();if(e){yield e;continue}const n=this.readValue();if(n){yield n;continue}return}}readOperator(){this.skipBlank();const e=this.matchTrie(this.opTrie);if(e!==-1)return new Fs(this.input,this.p,this.p=e,this.file)}matchTrie(e){let n=e,s=this.p,i;for(;n[this.input[s]]&&s<this.N;)n=n[this.input[s++]],n.end&&(i=n);return!i||i.needBoundary&&we(this.peek(s-this.p))?-1:s}readFilteredValue(){const e=this.p,n=this.readExpression();this.assert(n.valid(),`invalid value expression: ${this.snapshot()}`);const s=this.readFilters();return new Cs(n,s,this.input,e,this.p,this.file)}readFilters(){const e=[];for(;;){const n=this.readFilter();if(!n)return e;e.push(n)}}readFilter(){if(this.skipBlank(),this.end())return null;this.assert(this.read()==="|",'expected "|" before filter');const e=this.readIdentifier();if(!e.size())return this.assert(this.end(),"expected filter name"),null;const n=[];if(this.skipBlank(),this.peek()===":")do{++this.p;const s=this.readFilterArg();s&&n.push(s),this.skipBlank(),this.assert(this.end()||this.peek()===","||this.peek()==="|",()=>`unexpected character ${this.snapshot()}`)}while(this.peek()===",");else if(!(this.peek()==="|"||this.end()))throw this.error('expected ":" after filter name');return new $t(e.getText(),n,this.input,e.begin,this.p,this.file)}readFilterArg(){const e=this.readValue();if(!e)return;if(this.skipBlank(),this.peek()!==":")return e;++this.p;const n=this.readValue();return[e.getText(),n]}readTopLevelTokens(e=re){const n=[];for(;this.p<this.N;){const s=this.readTopLevelToken(e);n.push(s)}return gi(n,e),n}readTopLevelToken(e){const{tagDelimiterLeft:n,outputDelimiterLeft:s}=e;return this.rawBeginAt>-1?this.readEndrawOrRawContent(e):this.match(n)?this.readTagToken(e):this.match(s)?this.readOutputToken(e):this.readHTMLToken([n,s])}readHTMLToken(e){const n=this.p;for(;this.p<this.N&&!e.some(s=>this.match(s));)++this.p;return new jt(this.input,n,this.p,this.file)}readTagToken(e){const{file:n,input:s}=this,i=this.p;if(this.readToDelimiter(e.tagDelimiterRight)===-1)throw this.error(`tag ${this.snapshot(i)} not closed`,i);const r=new qt(s,i,this.p,e,n);return r.name==="raw"&&(this.rawBeginAt=i),r}readToDelimiter(e,n=!1){for(this.skipBlank();this.p<this.N;){if(n&&this.peekType()&_t){this.readQuoted();continue}if(++this.p,this.rmatch(e))return this.p}return-1}readOutputToken(e=re){const{file:n,input:s}=this,{outputDelimiterRight:i}=e,r=this.p;if(this.readToDelimiter(i,!0)===-1)throw this.error(`output ${this.snapshot(r)} not closed`,r);return new _s(s,r,this.p,e,n)}readEndrawOrRawContent(e){const{tagDelimiterLeft:n,tagDelimiterRight:s}=e,i=this.p;let r=this.readTo(n)-n.length;for(;this.p<this.N;){if(this.readIdentifier().getText()!=="endraw"){r=this.readTo(n)-n.length;continue}for(;this.p<=this.N;){if(this.rmatch(s)){const o=this.p;return i===r?(this.rawBeginAt=-1,new qt(this.input,i,o,e,this.file)):(this.p=r,new jt(this.input,i,r,this.file))}if(this.rmatch(n))break;this.p++}}throw this.error(`raw ${this.snapshot(this.rawBeginAt)} not closed`,i)}readLiquidTagTokens(e=re){const n=[];for(;this.p<this.N;){const s=this.readLiquidTagToken(e);s&&n.push(s)}return n}readLiquidTagToken(e){if(this.skipBlank(),this.end())return;const n=this.p;this.readToDelimiter(`
`);const s=this.p;return new Ns(this.input,n,s,e,this.file)}error(e,n=this.p){return new Gn(e,new He(this.input,n,this.N,this.file))}assert(e,n,s){if(!e)throw this.error(typeof n=="function"?n():n,s)}snapshot(e=this.p){return JSON.stringify(Zn(this.input.slice(e,this.N),32))}readWord(){return this.readIdentifier()}readIdentifier(){this.skipBlank();const e=this.p;for(;!this.end()&&we(this.peek());)++this.p;return new He(this.input,e,this.p,this.file)}readNonEmptyIdentifier(){const e=this.readIdentifier();return e.size()?e:void 0}readTagName(){return this.skipBlank(),this.input[this.p]==="#"?this.input.slice(this.p,++this.p):this.readIdentifier().getText()}readHashes(e){const n=[];for(;;){const s=this.readHash(e);if(!s)return n;n.push(s)}}readHash(e){this.skipBlank(),this.peek()===","&&++this.p;const n=this.p,s=this.readNonEmptyIdentifier();if(!s)return;let i;this.skipBlank();const r=p(e)?e:e?"=":":";return this.peek()===r&&(++this.p,i=this.readValue()),new Es(this.input,n,this.p,s,i,this.file)}remaining(){return this.input.slice(this.p,this.N)}advance(e=1){this.p+=e}end(){return this.p>=this.N}read(){return this.input[this.p++]}readTo(e){for(;this.p<this.N;)if(++this.p,this.rmatch(e))return this.p;return-1}readValue(){this.skipBlank();const e=this.p,n=this.readLiteral()||this.readQuoted()||this.readRange()||this.readNumber(),s=this.readProperties(!n);return s.length?new It(n,s,this.input,e,this.p):n}readScopeValue(){this.skipBlank();const e=this.p,n=this.readProperties();if(n.length)return new It(void 0,n,this.input,e,this.p)}readProperties(e=!0){const n=[];for(;;){if(this.peek()==="["){this.p++;const s=this.readValue()||new He(this.input,this.p,this.p,this.file);this.assert(this.readTo("]")!==-1,"[ not closed"),n.push(s);continue}if(e&&!n.length){const s=this.readNonEmptyIdentifier();if(s){n.push(s);continue}}if(this.peek()==="."&&this.peek(1)!=="."){this.p++;const s=this.readNonEmptyIdentifier();if(!s)break;n.push(s);continue}break}return n}readNumber(){this.skipBlank();let e=!1,n=!1,s=0;for(this.peekType()&as&&s++;this.p+s<=this.N;)if(this.peekType(s)&os)n=!0,s++;else if(this.peek(s)==="."&&this.peek(s+1)!=="."){if(e||!n)return;e=!0,s++}else break;if(n&&!we(this.peek(s))){const i=new xs(this.input,this.p,this.p+s,this.file);return this.advance(s),i}}readLiteral(){this.skipBlank();const e=this.matchTrie(this.literalTrie);if(e===-1)return;const n=new Ls(this.input,this.p,e,this.file);return this.p=e,n}readRange(){this.skipBlank();const e=this.p;if(this.peek()!=="(")return;++this.p;const n=this.readValueOrThrow();this.skipBlank(),this.assert(this.read()==="."&&this.read()===".","invalid range syntax");const s=this.readValueOrThrow();return this.skipBlank(),this.assert(this.read()===")","invalid range syntax"),new Ds(this.input,e,this.p,n,s,this.file)}readValueOrThrow(){const e=this.readValue();return this.assert(e,()=>`unexpected token ${this.snapshot()}, value expected`),e}readQuoted(){this.skipBlank();const e=this.p;if(!(this.peekType()&_t))return;++this.p;let n=!1;for(;this.p<this.N&&(++this.p,!(this.input[this.p-1]===this.input[e]&&!n));)n?n=!1:this.input[this.p-1]==="\\"&&(n=!0);return new Rs(this.input,e,this.p,this.file)}*readFileNameTemplate(e){const{outputDelimiterLeft:n}=e,s=[","," ","\r",`
`," ",n],i=new Set(s);for(;this.p<this.N&&!i.has(this.peek());)yield this.match(n)?this.readOutputToken(e):this.readHTMLToken(s)}match(e){for(let n=0;n<e.length;n++)if(e[n]!==this.input[this.p+n])return!1;return!0}rmatch(e){for(let n=0;n<e.length;n++)if(e[e.length-1-n]!==this.input[this.p-1-n])return!1;return!0}peekType(e=0){return this.p+e>=this.N?0:y[this.input.charCodeAt(this.p+e)]}peek(e=0){return this.p+e>=this.N?"":this.input[this.p+e]}skipBlank(){for(;this.peekType()&ie;)++this.p}}class wi{constructor(e,n){this.handlers={},this.stopRequested=!1,this.tokens=e,this.parseToken=n}on(e,n){return this.handlers[e]=n,this}trigger(e,n){const s=this.handlers[e];return s?(s.call(this,n),!0):!1}start(){this.trigger("start");let e;for(;!this.stopRequested&&(e=this.tokens.shift());){if(this.trigger("token",e)||K(e)&&this.trigger(`tag:${e.name}`,e))continue;const n=this.parseToken(e,this.tokens);this.trigger("template",n)}return this.stopRequested||this.trigger("end"),this}stop(){return this.stopRequested=!0,this}}class Be{constructor(e){this.token=e}}class v extends Be{constructor(e,n,s){super(e),this.name=e.name,this.liquid=s,this.tokenizer=e.tokenizer}}class oe{constructor(e,n){this.hash={};const s=e instanceof M?e:new M(e,{});for(const i of s.readHashes(n))this.hash[i.name.content]=i.value}*render(e){const n={};for(const s of Object.keys(this.hash))n[s]=this.hash[s]===void 0?!0:yield k(this.hash[s],e);return n}}function bi(t){return class extends v{constructor(e,n,s){super(e,n,s),T(t.parse)&&t.parse.call(this,e,n)}*render(e,n){const s=yield new oe(this.token.args,e.opts.keyValueSeparator).render(e);return yield t.render.call(this,e,n,s)}}}function Zt(t){return x(t)}class Gt{constructor(e,n,s){this.token=e,this.name=e.name,this.handler=T(n)?n:T(n?.handler)?n.handler:vt,this.raw=!T(n)&&!!n?.raw,this.args=e.args,this.liquid=s}*render(e,n){const s=[];for(const i of this.args)Zt(i)?s.push([i[0],yield k(i[1],n)]):s.push(yield k(i,n));return yield this.handler.apply({context:n,token:this.token,liquid:this.liquid},[e,...s])}}class F{constructor(e,n){this.filters=[];const s=typeof e=="string"?new M(e,n.options.operators).readFilteredValue():e;this.initial=s.initial,this.filters=s.filters.map(i=>new Gt(i,this.getFilter(n,i.name),n))}*value(e,n){n=n||e.opts.lenientIf&&this.filters.length>0&&this.filters[0].name==="default";let s=yield this.initial.evaluate(e,n);for(const i of this.filters)s=yield i.render(s,e);return s}getFilter(e,n){const s=e.filters[n];return L(s||!e.options.strictFilters,()=>`undefined filter: ${n}`),s}}class vi extends Be{constructor(e,n){var s;super(e);const i=new M(e.input,n.options.operators,e.file,e.contentRange);this.value=new F(i.readFilteredValue(),n);const r=this.value.filters,o=n.options.outputEscape;if(!(!((s=r[r.length-1])===null||s===void 0)&&s.raw)&&o){const a=new $t(toString.call(o),[],"",0,0);r.push(new Gt(a,o,n))}}*render(e,n){const s=yield this.value.value(e,!1);n.write(s)}*arguments(){yield this.value}}class ki extends Be{constructor(e){super(e),this.str=e.getContent()}*render(e,n){n.write(this.str)}}class te{constructor(e,n){this.segments=e,this.location=n}toString(){return xe(this.segments,!0)}toArray(){function*e(...n){for(const s of n)s instanceof te?yield Array.from(e(...s.segments)):yield s}return Array.from(e(...this.segments))}}class Je{constructor(){this.map=new Map}get(e){const n=xe([e.segments[0]]);return this.map.has(n)||this.map.set(n,[]),this.map.get(n)}has(e){return this.map.has(xe([e.segments[0]]))}push(e){this.get(e).push(e)}asObject(){return Object.fromEntries(this.map)}}const Xt={partials:!0};function*Kt(t,e,n){const s=new Je,i=new Je,r=new Je,o=new en(new Set),a=new Set;function c(l,h){s.push(l);const f=h.alias(l);if(f!==void 0){const w=f.segments[0];p(w)&&!o.has(w)&&i.push(f)}else{const w=l.segments[0];p(w)&&!h.has(w)&&i.push(l)}for(const w of l.segments)w instanceof te&&c(w,h)}function*u(l,h){if(l.arguments)for(const f of l.arguments())for(const w of tn(f))c(w,h);if(l.localScope)for(const f of l.localScope()){h.add(f.content),h.deleteAlias(f.content);const[w,W]=f.getPosition();r.push(new te([f.content],{row:w,col:W,file:f.file}))}if(l.children)if(l.partialScope){const f=l.partialScope();if(f===void 0){for(const D of yield l.children(e,n))yield u(D,h);return}if(a.has(f.name))return;const w=new Set,W=f.isolated?new en(w):h.push(w);for(const D of f.scope)if(p(D))w.add(D);else{const[se,he]=D;w.add(se);const U=Array.from(tn(he));U.length&&W.setAlias(se,U[0].segments)}for(const D of yield l.children(e,n))yield u(D,W),a.add(f.name);W.pop()}else{l.blockScope&&h.push(new Set(l.blockScope()));for(const f of yield l.children(e,n))yield u(f,h);l.blockScope&&h.pop()}}for(const l of t)yield u(l,o);return{variables:s.asObject(),globals:i.asObject(),locals:r.asObject()}}function B(t,e={}){const n=Object.assign(Object.assign({},Xt),e);return $(Kt(t,n.partials,!1))}function J(t,e={}){const n=Object.assign(Object.assign({},Xt),e);return V(Kt(t,n.partials,!0))}class en{constructor(e){this.stack=[{names:e,aliases:new Map}]}has(e){for(const n of this.stack)if(n.names.has(e))return!0;return!1}push(e){return this.stack.push({names:e,aliases:new Map}),this}pop(){var e;return(e=this.stack.pop())===null||e===void 0?void 0:e.names}add(e){this.stack[0].names.add(e)}alias(e){const n=e.segments[0];if(!p(n))return;const s=this.getAlias(n);if(s!==void 0)return new te([...s,...e.segments.slice(1)],e.location)}setAlias(e,n){this.stack[this.stack.length-1].aliases.set(e,n)}deleteAlias(e){this.stack[this.stack.length-1].aliases.delete(e)}getAlias(e){for(const n of this.stack){if(n.aliases.has(e))return n.aliases.get(e);if(n.names.has(e))return}}}function*tn(t){E(t)?yield*ae(t):t instanceof F&&(yield*Ti(t))}function*Ti(t){for(const e of t.initial.postfix)E(e)&&(yield*ae(e));for(const e of t.filters)for(const n of e.args)Zt(n)&&n[1]?yield*ae(n[1]):E(n)&&(yield*ae(n))}function*ae(t){an(t)?(yield*ae(t.lhs),yield*ae(t.rhs)):Le(t)&&(yield We(t))}function We(t){const e=[];let n=t.file;const s=t.props[0];n=n||s.file,Qe(s)||rn(s)||on(s)?e.push(s.content):Le(s)&&e.push(...We(s).segments);for(const o of t.props.slice(1))n=n||o.file,Qe(o)||rn(o)||on(o)?e.push(o.content):Le(o)&&e.push(We(o));const[i,r]=t.getPosition();return new te(e,{row:i,col:r,file:n})}const nn=/^[\u0080-\uFFFFa-zA-Z_][\u0080-\uFFFFa-zA-Z0-9_-]*$/;function xe(t,e=!1){const n=[],s=t[0];p(s)&&(!e||s.match(nn)?n.push(`${s}`):n.push(`['${s}']`));for(const i of t.slice(1))i instanceof te?n.push(`[${xe(i.segments)}]`):p(i)?i.match(nn)?n.push(`.${i}`):n.push(`['${i}']`):n.push(`[${i}]`);return n.join("")}var G;(function(t){t.Partials="partials",t.Layouts="layouts",t.Root="root"})(G||(G={}));class Si{constructor(e){if(this.options=e,e.relativeReference){const n=e.fs.sep;L(n,"`fs.sep` is required for relative reference");const s=new RegExp(["."+n,".."+n,"./","../"].map(i=>Bn(i)).join("|"));this.shouldLoadRelative=i=>s.test(i)}else this.shouldLoadRelative=n=>!1;this.contains=this.options.fs.contains||(()=>!0)}*lookup(e,n,s,i){const{fs:r}=this.options,o=this.options[n];for(const a of this.candidates(e,o,i,n!==G.Root))if(s?r.existsSync(a):yield r.exists(a))return a;throw this.lookupError(e,o)}*candidates(e,n,s,i){const{fs:r,extname:o}=this.options,a=c=>{if(!i)return!0;for(const u of n)if(this.contains(u,c))return!0;return!1};if(this.shouldLoadRelative(e)&&s){const c=r.resolve(this.dirname(s),e,o);a(c)&&(yield c)}for(const c of n){const u=r.resolve(c,e,o);a(u)&&(yield u)}if(r.fallback!==void 0){const c=r.fallback(e);c!==void 0&&a(c)&&(yield c)}}dirname(e){const n=this.options.fs;return L(n.dirname,"`fs.dirname` is required for relative reference"),n.dirname(e)}lookupError(e,n){const s=new Error("ENOENT");return s.message=`ENOENT: Failed to lookup "${e}" in "${n}"`,s.code="ENOENT",s}}class X{constructor(e){this.liquid=e,this.cache=this.liquid.options.cache,this.fs=this.liquid.options.fs,this.parseFile=this.cache?this._parseFileCached:this._parseFile,this.loader=new Si(this.liquid.options),this.parseLimit=new $e("parse length",e.options.parseLimit)}parse(e,n){e=String(e),this.parseLimit.use(e.length);const i=new M(e,this.liquid.options.operators,n).readTopLevelTokens(this.liquid.options);return this.parseTokens(i)}parseTokens(e){let n;const s=[],i=[];for(;n=e.shift();)try{s.push(this.parseToken(n,e))}catch(r){if(this.liquid.options.catchAllErrors)i.push(r);else throw r}if(i.length)throw new St(i);return s}parseToken(e,n){try{if(K(e)){const s=this.liquid.tags[e.name];return L(s,`tag "${e.name}" not found`),new s(e,n,this.liquid,this)}return xi(e)?new vi(e,this.liquid):new ki(e)}catch(s){throw Q.is(s)?s:new Xn(s,e)}}parseStream(e){return new wi(e,(n,s)=>this.parseToken(n,s))}*_parseFileCached(e,n,s=G.Root,i){const r=this.cache,o=this.loader.shouldLoadRelative(e)?i+","+e:s+":"+e,a=yield r.read(o);if(a)return a;const c=this._parseFile(e,n,s,i),u=n?yield c:$(c);r.write(o,u);try{return yield u}catch(l){throw r.remove(o),l}}*_parseFile(e,n,s=G.Root,i){const r=yield this.loader.lookup(e,s,n,i);return this.parse(n?this.fs.readFileSync(r):yield this.fs.readFile(r),r)}}var b;(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.FilteredValue=4096]="FilteredValue",t[t.Delimited=12]="Delimited"})(b||(b={}));function _i(t){return!!(C(t)&b.Delimited)}function sn(t){return C(t)===b.Operator}function Ye(t){return C(t)===b.HTML}function xi(t){return C(t)===b.Output}function K(t){return C(t)===b.Tag}function Qe(t){return C(t)===b.Quoted}function rn(t){return C(t)===b.Number}function Le(t){return C(t)===b.PropertyAccess}function on(t){return C(t)===b.Word}function an(t){return C(t)===b.Range}function E(t){return(C(t)&1667)>0}function C(t){return t?t.kind:-1}class ne{constructor(e={},n=re,s={},{memoryLimit:i,renderLimit:r}={}){var o,a,c,u,l;this.scopes=[{}],this.registers={},this.breakCalled=!1,this.continueCalled=!1,this.sync=!!s.sync,this.opts=n,this.globals=(o=s.globals)!==null&&o!==void 0?o:n.globals,this.environments=ge(e)?e:Object(e),this.strictVariables=(a=s.strictVariables)!==null&&a!==void 0?a:this.opts.strictVariables,this.ownPropertyOnly=(c=s.ownPropertyOnly)!==null&&c!==void 0?c:n.ownPropertyOnly,this.memoryLimit=i??new $e("memory alloc",(u=s.memoryLimit)!==null&&u!==void 0?u:n.memoryLimit),this.renderLimit=r??new $e("template render",Bt().now()+((l=s.renderLimit)!==null&&l!==void 0?l:n.renderLimit))}getRegister(e){return this.registers[e]=this.registers[e]||{}}setRegister(e,n){return this.registers[e]=n}saveRegister(...e){return e.map(n=>[n,this.getRegister(n)])}restoreRegister(e){return e.forEach(([n,s])=>this.setRegister(n,s))}getAll(){return[this.globals,this.environments,...this.scopes].reduce((e,n)=>ve(e,n),{})}get(e){return this.getSync(e)}getSync(e){return V(this._get(e))}*_get(e){const n=this.findScope(e[0]);return yield this._getFromScope(n,e)}getFromScope(e,n){return V(this._getFromScope(e,n))}*_getFromScope(e,n,s=this.strictVariables){p(n)&&(n=n.split("."));for(let i=0;i<n.length;i++)if(e=yield this.readProperty(e,n[i]),s&&Jn(e))throw new ts(n.slice(0,i+1).join("."));return e}push(e){return this.scopes.push(e)}pop(){return this.scopes.pop()}bottom(){return this.scopes[0]}spawn(e={}){return new ne(e,this.opts,{sync:this.sync,globals:this.globals,strictVariables:this.strictVariables},{renderLimit:this.renderLimit,memoryLimit:this.memoryLimit})}findScope(e){for(let n=this.scopes.length-1;n>=0;n--){const s=this.scopes[n];if(e in s)return s}return e in this.environments?this.environments:this.globals}readProperty(e,n){if(e=pt(e),n=g(n),z(e))return e;if(x(e)&&n<0)return e[e.length+ +n];const s=Li(e,n,this.ownPropertyOnly);return s===void 0&&e instanceof Y?e.liquidMethodMissing(n,this):T(s)?s.call(e):n==="size"?Ei(e):n==="first"?Oi(e):n==="last"?Fi(e):s}}function Li(t,e,n){if(!(n&&!Pe.call(t,e)&&!(t instanceof Y)))return t[e]}function Oi(t){return x(t)?t[0]:t.first}function Fi(t){return x(t)?t[t.length-1]:t.last}function Ei(t){if(Pe.call(t,"size")||t.size!==void 0)return t.size;if(x(t)||p(t))return t.length;if(typeof t=="object")return Object.keys(t).length}var ee;(function(t){t[t.OUTPUT=0]="OUTPUT",t[t.STORE=1]="STORE"})(ee||(ee={}));const Ai=q(Math.abs),zi=q(Math.max),Ri=q(Math.min),Di=q(Math.ceil),Ni=q((t,e,n=!1)=>n?Math.floor(t/e):t/e),Ci=q(Math.floor),Pi=q((t,e)=>t-e),qi=q((t,e)=>t+e),ji=q((t,e)=>t%e),Mi=q((t,e)=>t*e);function Ii(t,e=0){t=qe(t),e=qe(e);const n=Math.pow(10,e);return Math.round(t*n)/n}var $i=Object.freeze({__proto__:null,abs:Ai,at_least:zi,at_most:Ri,ceil:Di,divided_by:Ni,floor:Ci,minus:Pi,plus:qi,modulo:ji,times:Mi,round:Ii});const Vi=t=>decodeURIComponent(d(t)).replace(/\+/g," "),Hi=t=>encodeURIComponent(d(t)).replace(/%20/g,"+"),Ui=t=>encodeURIComponent(d(t)).replace(/%20/g,"+").replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase()),Bi=t=>encodeURI(d(t)).replace(/%5B/g,"[").replace(/%5D/g,"]"),ln=/[^\p{M}\p{L}\p{Nd}]+/ug,Ji={raw:/\s+/g,default:ln,pretty:/[^\p{M}\p{L}\p{Nd}._~!$&'()+,;=@]+/ug,ascii:/[^A-Za-z0-9]+/g,latin:ln,none:null};function Wi(t,e="default",n=!1){t=d(t);const s=Ji[e];return s&&(e==="latin"&&(t=Yi(t)),t=t.replace(s,"-").replace(/^-|-$/g,"")),n?t:t.toLowerCase()}function Yi(t){return t.replace(/[àáâãäå]/g,"a").replace(/[æ]/g,"ae").replace(/[ç]/g,"c").replace(/[èéêë]/g,"e").replace(/[ìíîï]/g,"i").replace(/[ð]/g,"d").replace(/[ñ]/g,"n").replace(/[òóôõöø]/g,"o").replace(/[ùúûü]/g,"u").replace(/[ýÿ]/g,"y").replace(/[ß]/g,"ss").replace(/[œ]/g,"oe").replace(/[þ]/g,"th").replace(/[ẞ]/g,"SS").replace(/[Œ]/g,"OE").replace(/[Þ]/g,"TH")}var Qi=Object.freeze({__proto__:null,url_decode:Vi,url_encode:Hi,cgi_escape:Ui,uri_escape:Bi,slugify:Wi});const Zi=me(function(t,e){const n=_(t),s=z(e)?" ":d(e),i=n.length*(1+s.length);return this.context.memoryLimit.use(i),n.join(s)}),Gi=me(t=>gt(t)?yt(t):""),Xi=me(t=>gt(t)?t[0]:""),Ki=me(function(t){const e=_(t);return this.context.memoryLimit.use(e.length),[...e].reverse()});function*er(t,e){const n=[],s=_(t);this.context.memoryLimit.use(s.length);for(const i of s)n.push([i,e?yield this.context._getFromScope(i,d(e).split("."),!1):i]);return n.sort((i,r)=>{const o=i[1],a=r[1];return o<a?-1:o>a?1:0}).map(i=>i[0])}function tr(t,e){const n=d(e),s=e===void 0?kt:(r,o)=>kt(r[n],o[n]),i=_(t);return this.context.memoryLimit.use(i.length),[...i].sort(s)}const nr=t=>t&&t.length||0;function*sr(t,e){const n=[],s=_(t);this.context.memoryLimit.use(s.length);for(const i of s)n.push(yield this.context._getFromScope(i,d(e),!1));return n}function*ir(t,e){let n=0;const s=_(t);for(const i of s){const r=Number(e?yield this.context._getFromScope(i,d(e),!1):i);n+=Number.isNaN(r)?0:r}return n}function rr(t){const e=_(t);return this.context.memoryLimit.use(e.length),e.filter(n=>!z(g(n)))}function cn(t,e=[]){const n=_(t),s=_(e);return this.context.memoryLimit.use(n.length+s.length),n.concat(s)}function or(t,e){return cn.call(this,t,[e])}function ar(t,e){const n=_(t);this.context.memoryLimit.use(n.length);const s=[...n];return s.unshift(e),s}function lr(t){const e=[..._(t)];return e.pop(),e}function cr(t){const e=_(t);this.context.memoryLimit.use(e.length);const n=[...e];return n.shift(),n}function ur(t,e,n=1){return t=g(t),z(t)?[]:(x(t)||(t=d(t)),e=e<0?t.length+e:e,this.context.memoryLimit.use(n),t.slice(e,e+n))}function un(t){return this.context.opts.jekyllWhere?e=>le.is(t)?H(e,t):x(e)?Bs(e,t):H(e,t):t===void 0?e=>Z(e,this.context):e=>H(e,t)}function*hn(t,e,n,s){const i=[];e=_(e),this.context.memoryLimit.use(e.length);const r=new M(d(n)).readScopeValue();for(const a of e)i.push(yield k(r,this.context.spawn(a)));const o=un.call(this,s);return e.filter((a,c)=>o(i[c])===t)}function*dn(t,e,n,s){const i=[],r=new F(d(s),this.liquid),o=_(e);this.context.memoryLimit.use(o.length);for(const a of o){this.context.push({[n]:a});const c=yield r.value(this.context);this.context.pop(),c===t&&i.push(a)}return i}function*hr(t,e,n){return yield*hn.call(this,!0,t,e,n)}function*dr(t,e,n){return yield*hn.call(this,!1,t,e,n)}function*fr(t,e,n){return yield*dn.call(this,!0,t,e,n)}function*pr(t,e,n){return yield*dn.call(this,!1,t,e,n)}function*gr(t,e){const n=new Map;t=ce(t);const s=new M(d(e)).readScopeValue();this.context.memoryLimit.use(t.length);for(const i of t){const r=yield k(s,this.context.spawn(i));n.has(r)||n.set(r,[]),n.get(r).push(i)}return[...n.entries()].map(([i,r])=>({name:i,items:r}))}function*mr(t,e,n){const s=new Map,i=new F(d(n),this.liquid);t=ce(t),this.context.memoryLimit.use(t.length);for(const r of t){this.context.push({[e]:r});const o=yield i.value(this.context);this.context.pop(),s.has(o)||s.set(o,[]),s.get(o).push(r)}return[...s.entries()].map(([r,o])=>({name:r,items:o}))}function*Ze(t,e,n){const s=new M(d(e)).readScopeValue(),i=_(t),r=un.call(this,n);for(let o=0;o<i.length;o++){const a=yield k(s,this.context.spawn(i[o]));if(r(a))return[o,i[o]]}}function*Ge(t,e,n){const s=new F(d(n),this.liquid),i=_(t);for(let r=0;r<i.length;r++){this.context.push({[e]:i[r]});const o=yield s.value(this.context);if(this.context.pop(),o)return[r,i[r]]}}function*yr(t,e,n){return!!(yield*Ze.call(this,t,e,n))}function*wr(t,e,n){return!!(yield*Ge.call(this,t,e,n))}function*br(t,e,n){const s=yield*Ze.call(this,t,e,n);return s?s[0]:void 0}function*vr(t,e,n){const s=yield*Ge.call(this,t,e,n);return s?s[0]:void 0}function*kr(t,e,n){const s=yield*Ze.call(this,t,e,n);return s?s[1]:void 0}function*Tr(t,e,n){const s=yield*Ge.call(this,t,e,n);return s?s[1]:void 0}function Sr(t){return t=_(t),this.context.memoryLimit.use(t.length),[...new Set(t)]}function _r(t,e=1){if(t=g(t),z(t))return[];x(t)||(t=d(t)),this.context.memoryLimit.use(e);const n=[...t].sort(()=>Math.random()-.5);return e===1?n[0]:n.slice(0,e)}var xr=Object.freeze({__proto__:null,join:Zi,last:Gi,first:Xi,reverse:Ki,sort:er,sort_natural:tr,size:nr,map:sr,sum:ir,compact:rr,concat:cn,push:or,unshift:ar,pop:lr,shift:cr,slice:ur,where:hr,reject:dr,where_exp:fr,reject_exp:pr,group_by:gr,group_by_exp:mr,has:yr,has_exp:wr,find_index:br,find_index_exp:vr,find:kr,find_exp:Tr,uniq:Sr,sample:_r});function Xe(t,e,n){var s,i,r;const o=((s=t?.length)!==null&&s!==void 0?s:0)+((i=e?.length)!==null&&i!==void 0?i:0)+((r=n?