Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@appmate/wishlist

Package Overview
Dependencies
Maintainers
1
Versions
212
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@appmate/wishlist - npm Package Compare versions

Comparing version 4.17.4 to 4.17.5

2

components/badge.js

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

var m=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var r=(p,n,i,o)=>{for(var t=o>1?void 0:o?y(n,i):n,l=p.length-1,s;l>=0;l--)(s=p[l])&&(t=(o?s(n,i,t):s(t))||t);return o&&t&&m(n,i,t),t};import{LitElement as c}from"https://cdn.jsdelivr.net/npm/lit-element@3.2.2/lit-element/+esm";import{customElement as g,property as a}from"https://cdn.jsdelivr.net/npm/@lit/reactive-element@1.4.2/decorators/+esm";import{html as h}from"https://cdn.jsdelivr.net/npm/lit-html@2.4.0/+esm";import{FloatingUiController as u}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.4/controllers.js";var e=class extends c{constructor(){super(...arguments);this.text="";this.layout="text-only";this.parentheses=!1;this.floatingUi=new u(this)}render(){var t,l;let i=(t=this.layout)!=null&&t.includes("text")?this.text:"",o=["wk-badge",!!this.parentheses&&"wk-parentheses",((l=this.layout)==null?void 0:l.includes("pill"))&&"wk-pill"].filter(s=>!!s).join(" ");return h`<span class=${o}>${i}</span>`}createRenderRoot(){return this}};r([a({type:String})],e.prototype,"text",2),r([a({type:String})],e.prototype,"layout",2),r([a({type:Boolean})],e.prototype,"parentheses",2),r([a({type:Object})],e.prototype,"floating",2),e=r([g("wk-badge")],e);export{e as Badge};
var m=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var r=(p,n,i,o)=>{for(var t=o>1?void 0:o?y(n,i):n,l=p.length-1,s;l>=0;l--)(s=p[l])&&(t=(o?s(n,i,t):s(t))||t);return o&&t&&m(n,i,t),t};import{LitElement as c}from"https://cdn.jsdelivr.net/npm/lit-element@3.2.2/lit-element/+esm";import{customElement as g,property as a}from"https://cdn.jsdelivr.net/npm/@lit/reactive-element@1.4.2/decorators/+esm";import{html as h}from"https://cdn.jsdelivr.net/npm/lit-html@2.4.0/+esm";import{FloatingUiController as u}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.5/controllers.js";var e=class extends c{constructor(){super(...arguments);this.text="";this.layout="text-only";this.parentheses=!1;this.floatingUi=new u(this)}render(){var t,l;let i=(t=this.layout)!=null&&t.includes("text")?this.text:"",o=["wk-badge",!!this.parentheses&&"wk-parentheses",((l=this.layout)==null?void 0:l.includes("pill"))&&"wk-pill"].filter(s=>!!s).join(" ");return h`<span class=${o}>${i}</span>`}createRenderRoot(){return this}};r([a({type:String})],e.prototype,"text",2),r([a({type:String})],e.prototype,"layout",2),r([a({type:Boolean})],e.prototype,"parentheses",2),r([a({type:Object})],e.prototype,"floating",2),e=r([g("wk-badge")],e);export{e as Badge};

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

var u=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var r=(o,n,e,i)=>{for(var l=i>1?void 0:i?c(n,e):n,s=o.length-1,g;s>=0;s--)(g=o[s])&&(l=(i?g(n,e,l):g(l))||l);return i&&l&&u(n,e,l),l};import{LitElement as y}from"https://cdn.jsdelivr.net/npm/lit-element@3.2.2/lit-element/+esm";import{customElement as x,property as a}from"https://cdn.jsdelivr.net/npm/@lit/reactive-element@1.4.2/decorators/+esm";import{html as d}from"https://cdn.jsdelivr.net/npm/lit-html@2.4.0/+esm";var h=Number.isNaN||function(n){return typeof n=="number"&&n!==n};function p(o,n){return!!(o===n||h(o)&&h(n))}function m(o,n){if(o.length!==n.length)return!1;for(var e=0;e<o.length;e++)if(!p(o[e],n[e]))return!1;return!0}function f(o,n){n===void 0&&(n=m);var e=null;function i(){for(var l=[],s=0;s<arguments.length;s++)l[s]=arguments[s];if(e&&e.lastThis===this&&n(l,e.lastArgs))return e.lastResult;var g=o.apply(this,l);return e={lastResult:g,lastArgs:l,lastThis:this},g}return i.clear=function(){e=null},i}import{FloatingUiController as $}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.4/controllers.js";import"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.4/components/badge.js";import"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.4/components/icon.js";var t=class extends y{constructor(){super(...arguments);this.text="";this.hint="";this.selected=!1;this.disabled=!1;this.layout="icon-and-text";this.outline=!1;this.fullWidth=!1;this.alignment="center";this.badgeParentheses=!1;this.badgeHidden=!1;this.badgeHiddenIfEmpty=!1;this.floatingUi=new $(this);this.getBadgeFloating=f((e,i)=>{if(!(!e||!i))return{...e,reference:i}})}render(){var l,s,g;let i=["wk-button",`wk-align-${(l=this.alignment)!=null?l:"center"}`,this.selected&&"wk-selected",this.outline&&"wk-outline",this.fullWidth&&"wk-full-width"].filter(b=>!!b).join(" ");return this.href?d`
var u=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var r=(o,n,e,i)=>{for(var l=i>1?void 0:i?c(n,e):n,s=o.length-1,g;s>=0;s--)(g=o[s])&&(l=(i?g(n,e,l):g(l))||l);return i&&l&&u(n,e,l),l};import{LitElement as y}from"https://cdn.jsdelivr.net/npm/lit-element@3.2.2/lit-element/+esm";import{customElement as x,property as a}from"https://cdn.jsdelivr.net/npm/@lit/reactive-element@1.4.2/decorators/+esm";import{html as d}from"https://cdn.jsdelivr.net/npm/lit-html@2.4.0/+esm";var h=Number.isNaN||function(n){return typeof n=="number"&&n!==n};function p(o,n){return!!(o===n||h(o)&&h(n))}function m(o,n){if(o.length!==n.length)return!1;for(var e=0;e<o.length;e++)if(!p(o[e],n[e]))return!1;return!0}function f(o,n){n===void 0&&(n=m);var e=null;function i(){for(var l=[],s=0;s<arguments.length;s++)l[s]=arguments[s];if(e&&e.lastThis===this&&n(l,e.lastArgs))return e.lastResult;var g=o.apply(this,l);return e={lastResult:g,lastArgs:l,lastThis:this},g}return i.clear=function(){e=null},i}import{FloatingUiController as $}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.5/controllers.js";import"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.5/components/badge.js";import"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.5/components/icon.js";var t=class extends y{constructor(){super(...arguments);this.text="";this.hint="";this.selected=!1;this.disabled=!1;this.layout="icon-and-text";this.outline=!1;this.fullWidth=!1;this.alignment="center";this.badgeParentheses=!1;this.badgeHidden=!1;this.badgeHiddenIfEmpty=!1;this.floatingUi=new $(this);this.getBadgeFloating=f((e,i)=>{if(!(!e||!i))return{...e,reference:i}})}render(){var l,s,g;let i=["wk-button",`wk-align-${(l=this.alignment)!=null?l:"center"}`,this.selected&&"wk-selected",this.outline&&"wk-outline",this.fullWidth&&"wk-full-width"].filter(b=>!!b).join(" ");return this.href?d`
<a href=${this.href} aria-label=${(s=this.hint)!=null?s:""} class=${i}>

@@ -3,0 +3,0 @@ ${this.renderIcon()}${this.renderText()}${this.renderBadge()}

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

var m=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=(l,r,i,e)=>{for(var t=e>1?void 0:e?u(r,i):r,s=l.length-1,o;s>=0;s--)(o=l[s])&&(t=(e?o(r,i,t):o(t))||t);return e&&t&&m(r,i,t),t};import{LitElement as h}from"https://cdn.jsdelivr.net/npm/lit-element@3.2.2/lit-element/+esm";import{customElement as w,property as p}from"https://cdn.jsdelivr.net/npm/@lit/reactive-element@1.4.2/decorators/+esm";import{html as d}from"https://cdn.jsdelivr.net/npm/lit-html@2.4.0/+esm";import{Icon as k}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.4/components/icon.js";var n=class extends h{constructor(){super();this.icon="caret"}render(){var s;if(!this.option)return;let i=`options[${this.option.name}]`,e=`wk-input__${i}`,t=["wk-option-select",((s=this.option)==null?void 0:s.values.length)===1&&"wk-single-option"].filter(o=>!!o).join(" ");return d`
var m=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=(l,r,i,e)=>{for(var t=e>1?void 0:e?u(r,i):r,s=l.length-1,o;s>=0;s--)(o=l[s])&&(t=(e?o(r,i,t):o(t))||t);return e&&t&&m(r,i,t),t};import{LitElement as h}from"https://cdn.jsdelivr.net/npm/lit-element@3.2.2/lit-element/+esm";import{customElement as w,property as p}from"https://cdn.jsdelivr.net/npm/@lit/reactive-element@1.4.2/decorators/+esm";import{html as d}from"https://cdn.jsdelivr.net/npm/lit-html@2.4.0/+esm";import{Icon as k}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.5/components/icon.js";var n=class extends h{constructor(){super();this.icon="caret"}render(){var s;if(!this.option)return;let i=`options[${this.option.name}]`,e=`wk-input__${i}`,t=["wk-option-select",((s=this.option)==null?void 0:s.values.length)===1&&"wk-single-option"].filter(o=>!!o).join(" ");return d`
<div class=${t}>

@@ -3,0 +3,0 @@ <label class="wk-label" for=${e}>${this.option.name}</label>

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

var p=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var r=(a,n,t,o)=>{for(var i=o>1?void 0:o?c(n,t):n,s=a.length-1,d;s>=0;s--)(d=a[s])&&(i=(o?d(n,t,i):d(i))||i);return o&&i&&p(n,t,i),i};import{LitElement as u,css as w}from"https://cdn.jsdelivr.net/npm/lit-element@3.2.2/lit-element/+esm";import{customElement as m,state as v,property as l}from"https://cdn.jsdelivr.net/npm/@lit/reactive-element@1.4.2/decorators/+esm";import{html as f}from"https://cdn.jsdelivr.net/npm/lit-html@2.4.0/+esm";import{FloatingUiController as g}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.4/controllers.js";var e=class extends u{constructor(){super(...arguments);this.text="";this.autoShow=!1;this.autoHide=!1;this.floatingUi=new g(this)}get added(){return!!this.parentElement}get showing(){return this.transition==="show"}get hiding(){return this.transition==="hide"}render(){var o;let t=["wk-popover",this.transition?`wk-${this.transition}`:"",this.elementClass].filter(i=>!!i).join(" ");return f`
var p=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var r=(a,n,t,o)=>{for(var i=o>1?void 0:o?c(n,t):n,s=a.length-1,d;s>=0;s--)(d=a[s])&&(i=(o?d(n,t,i):d(i))||i);return o&&i&&p(n,t,i),i};import{LitElement as u,css as w}from"https://cdn.jsdelivr.net/npm/lit-element@3.2.2/lit-element/+esm";import{customElement as m,state as v,property as l}from"https://cdn.jsdelivr.net/npm/@lit/reactive-element@1.4.2/decorators/+esm";import{html as f}from"https://cdn.jsdelivr.net/npm/lit-html@2.4.0/+esm";import{FloatingUiController as g}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.5/controllers.js";var e=class extends u{constructor(){super(...arguments);this.text="";this.autoShow=!1;this.autoHide=!1;this.floatingUi=new g(this)}get added(){return!!this.parentElement}get showing(){return this.transition==="show"}get hiding(){return this.transition==="hide"}render(){var o;let t=["wk-popover",this.transition?`wk-${this.transition}`:"",this.elementClass].filter(i=>!!i).join(" ");return f`
<div class=${t}>

@@ -3,0 +3,0 @@ <div class="wk-text">${this.getText()}</div>

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

var p=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var o=(l,n,e,t)=>{for(var s=t>1?void 0:t?m(n,e):n,r=l.length-1,a;r>=0;r--)(a=l[r])&&(s=(t?a(n,e,s):a(s))||s);return t&&s&&p(n,e,s),s};import{LitElement as d}from"https://cdn.jsdelivr.net/npm/lit-element@3.2.2/lit-element/+esm";import{html as h}from"https://cdn.jsdelivr.net/npm/lit-html@2.4.0/+esm";import{customElement as f,property as c}from"https://cdn.jsdelivr.net/npm/@lit/reactive-element@1.4.2/decorators/+esm";import{Swatch as b}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.4/components/swatch.js";var i=class extends d{constructor(){super();this.label="";this.name="";this.options=[]}connectedCallback(){super.connectedCallback();for(let e of this.children)e instanceof b&&this.options.push(e);this.innerHTML=""}render(){let e=["wk-swatches",this.options.length===1&&"wk-single-option"].filter(t=>!!t).join(" ");return h`
var p=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var o=(l,n,e,t)=>{for(var s=t>1?void 0:t?m(n,e):n,r=l.length-1,a;r>=0;r--)(a=l[r])&&(s=(t?a(n,e,s):a(s))||s);return t&&s&&p(n,e,s),s};import{LitElement as d}from"https://cdn.jsdelivr.net/npm/lit-element@3.2.2/lit-element/+esm";import{html as h}from"https://cdn.jsdelivr.net/npm/lit-html@2.4.0/+esm";import{customElement as f,property as c}from"https://cdn.jsdelivr.net/npm/@lit/reactive-element@1.4.2/decorators/+esm";import{Swatch as b}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.5/components/swatch.js";var i=class extends d{constructor(){super();this.label="";this.name="";this.options=[]}connectedCallback(){super.connectedCallback();for(let e of this.children)e instanceof b&&this.options.push(e);this.innerHTML=""}render(){let e=["wk-swatches",this.options.length===1&&"wk-single-option"].filter(t=>!!t).join(" ");return h`
<div class=${e}>

@@ -3,0 +3,0 @@ <fieldset class="wk-fieldset">

@@ -12,2 +12,2 @@ var V=class{constructor(){this.mapWishlistState=t=>({id:t.id,public_id:t.publicId,is_mine:t.isMine,num_items:t.numItems,items:t.items.map(i=>({id:i.id,product_id:i.productId,variant_id:i.variantId}))});this.mapProductInfo=t=>({product_id:t.productId,variant_id:t.variantId,in_wishlist:t.inWishlist,wishlist_item_id:t.wishlistItemId});this.mapWishlistItem=t=>{var i,r,s;return{id:t.id,loading:!((i=t.product)!=null&&i.url)&&!((r=t.product)!=null&&r.hidden),hidden:!!((s=t.product)!=null&&s.hidden),selected_variant_id:t.variantId,product:t.product}}}camelToSnakeCase(t){return t.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`)}objectToSnakeCase(t){return typeof t!="object"?t:Object.fromEntries(Object.entries(t).map(([i,r])=>{if(typeof r=="function")return[i,null];let s=this.camelToSnakeCase(i);return Array.isArray(r)?[s,r.map(n=>this.objectToSnakeCase(n))]:r&&typeof r=="object"?[s,this.objectToSnakeCase(r)]:[s,r]}))}};var X=function(){return X=Object.assign||function(t){for(var i,r=1,s=arguments.length;r<s;r++){i=arguments[r];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},X.apply(this,arguments)};function O(e,t,i,r){function s(n){return n instanceof i?n:new i(function(o){o(n)})}return new(i||(i=Promise))(function(n,o){function l(p){try{u(r.next(p))}catch(y){o(y)}}function a(p){try{u(r.throw(p))}catch(y){o(y)}}function u(p){p.done?n(p.value):s(p.value).then(l,a)}u((r=r.apply(e,t||[])).next())})}var x=class{liquidMethodMissing(t){}},Mt=Object.prototype.toString,tt=String.prototype.toLowerCase,ft=Object.hasOwnProperty;function L(e){return typeof e=="string"}function q(e){return typeof e=="function"}function At(e){return e&&q(e.then)}function K(e){return e&&q(e.next)&&q(e.throw)&&q(e.return)}function $t(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function c(e){return e=h(e),L(e)?e:E(e)?"":T(e)?e.map(t=>c(t)).join(""):String(e)}function h(e){return e instanceof x&&q(e.valueOf)?e.valueOf():e}function De(e){return typeof e=="number"}function gt(e){return e&&q(e.toLiquid)?gt(e.toLiquid()):e}function E(e){return e==null}function T(e){return Mt.call(e)==="[object Array]"}function Ct(e){return Ve(e)&&Symbol.iterator in e}function le(e,t){e=e||{};for(let i in e)if(ft.call(e,i)&&t(e[i],i,e)===!1)break;return e}function We(e){return e[e.length-1]}function Ve(e){let t=typeof e;return e!==null&&(t==="object"||t==="function")}function mt(e,t,i=1){let r=[];for(let s=e;s<t;s+=i)r.push(s);return r}function ee(e,t,i=" "){return wt(e,t,i,(r,s)=>s+r)}function Ut(e,t,i=" "){return wt(e,t,i,(r,s)=>r+s)}function wt(e,t,i,r){e=String(e);let s=t-e.length;for(;s-- >0;)e=r(e,i);return e}function yt(e){return e}function ue(e){return e.replace(/(\w?)([A-Z])/g,(t,i,r)=>(i?i+"_":"")+r.toLowerCase())}function zt(e){return[...e].some(i=>i>="a"&&i<="z")?e.toUpperCase():e.toLowerCase()}function Dt(e,t){return e.length>t?e.slice(0,t-3)+"...":e}function it(e,t){return e==null&&t==null?0:e==null?1:t==null||(e=tt.call(e),t=tt.call(t),e<t)?-1:e>t?1:0}function k(e){return(...t)=>e(...t.map(h))}function Be(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}var B=class{constructor(t,i,r,s){this.key=t,this.value=i,this.next=r,this.prev=s}},te=class{constructor(t,i=0){this.limit=t,this.size=i,this.cache={},this.head=new B("HEAD",null,null,null),this.tail=new B("TAIL",null,null,null),this.head.next=this.tail,this.tail.prev=this.head}write(t,i){if(this.cache[t])this.cache[t].value=i;else{let r=new B(t,i,this.head.next,this.head);this.head.next.prev=r,this.head.next=r,this.cache[t]=r,this.size++,this.ensureLimit()}}read(t){if(!this.cache[t])return;let{value:i}=this.cache[t];return this.remove(t),this.write(t,i),i}remove(t){let i=this.cache[t];i.prev.next=i.next,i.next.prev=i.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 Tt(e,t){let i=document.createElement("base");i.href=e;let r=document.getElementsByTagName("head")[0];r.insertBefore(i,r.firstChild);let s=document.createElement("a");s.href=t;let n=s.href;return r.removeChild(i),n}function Wt(e,t,i){return e.length&&We(e)!=="/"&&(e+="/"),Tt(e,t).replace(/^(\w+:\/\/[^/]+)(\/[^?]+)/,(s,n,o)=>{let l=o.split("/").pop();return/\.\w+$/.test(l)?s:n+o+i})}function Vt(e){return O(this,void 0,void 0,function*(){return new Promise((t,i)=>{let r=new XMLHttpRequest;r.onload=()=>{r.status>=200&&r.status<300?t(r.responseText):i(new Error(r.statusText))},r.onerror=()=>{i(new Error("An error occurred whilst receiving the response."))},r.open("GET",e),r.send()})})}function Bt(e){let t=new XMLHttpRequest;if(t.open("GET",e,!1),t.send(),t.status<200||t.status>=300)throw new Error(t.statusText);return t.responseText}function jt(e){return O(this,void 0,void 0,function*(){return!0})}function Ht(e){return!0}function Qt(e){return Tt(e,".")}var Yt="/",Jt=Object.freeze({__proto__:null,resolve:Wt,readFile:Vt,readFileSync:Bt,exists:jt,existsSync:Ht,dirname:Qt,sep:Yt});function b(e){return e&&q(e.equals)}function N(e,t){return!je(e,t)}function je(e,t){return t.opts.jsTruthy?!e:e===!1||e===void 0||e===null}var rt={"==":(e,t)=>b(e)?e.equals(t):b(t)?t.equals(e):h(e)===h(t),"!=":(e,t)=>b(e)?!e.equals(t):b(t)?!t.equals(e):h(e)!==h(t),">":(e,t)=>b(e)?e.gt(t):b(t)?t.lt(e):h(e)>h(t),"<":(e,t)=>b(e)?e.lt(t):b(t)?t.gt(e):h(e)<h(t),">=":(e,t)=>b(e)?e.geq(t):b(t)?t.leq(e):h(e)>=h(t),"<=":(e,t)=>b(e)?e.leq(t):b(t)?t.geq(e):h(e)<=h(t),contains:(e,t)=>(e=h(e),t=h(t),e&&q(e.indexOf)?e.indexOf(t)>-1:!1),and:(e,t,i)=>N(h(e),i)&&N(h(t),i),or:(e,t,i)=>N(h(e),i)||N(h(t),i)},d=[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],He=1,ae=4,st=8,bt=16,Gt=32,Zt=64;d[160]=d[5760]=d[6158]=d[8192]=d[8193]=d[8194]=d[8195]=d[8196]=d[8197]=d[8198]=d[8199]=d[8200]=d[8201]=d[8202]=d[8232]=d[8233]=d[8239]=d[8287]=d[12288]=ae;function _t(e){let t={};for(let[i,r]of Object.entries(e)){let s=t;for(let n=0;n<i.length;n++){let o=i[n];s[o]=s[o]||{},n===i.length-1&&d[i.charCodeAt(n)]&He&&(s[o].needBoundary=!0),s=s[o]}s.handler=r,s.end=!0}return t}var Xt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&#34;","'":"&#39;"},Kt={"&amp;":"&","&lt;":"<","&gt;":">","&#34;":'"',"&#39;":"'"};function kt(e){return c(e).replace(/&|<|>|"|'/g,t=>Xt[t])}function ei(e){return c(e).replace(/&(amp|lt|gt|#34|#39);/g,t=>Kt[t])}function ti(e){return kt(ei(c(e)))}function ii(e){return c(e).replace(/\n/g,`<br />

`&&e.trimLeft++}var ye=class extends _{constructor(t,i){super(f.Number,t.input,t.begin,i?i.end:t.end,t.file),this.whole=t,this.decimal=i}},U=class extends _{constructor(t,i,r,s){super(f.Word,t,i,r,s),this.input=t,this.begin=i,this.end=r,this.file=s,this.content=this.getText()}isNumber(t=!1){let i=t&&d[this.input.charCodeAt(this.begin)]&Zt?this.begin+1:this.begin;for(let r=i;r<this.end;r++)if(!(d[this.input.charCodeAt(r)]&Gt))return!1;return!0}},Te=class extends _{constructor(t,i,r,s){super(f.Literal,t,i,r,s),this.input=t,this.begin=i,this.end=r,this.file=s,this.literal=this.getText()}},ht={"==":1,"!=":1,">":1,"<":1,">=":1,"<=":1,contains:1,and:0,or:0},be=class extends _{constructor(t,i,r,s){super(f.Operator,t,i,r,s),this.input=t,this.begin=i,this.end=r,this.file=s,this.operator=this.getText()}getPrecedence(){let t=this.getText();return t in ht?ht[t]:1}},re=class extends _{constructor(t,i,r){super(f.PropertyAccess,t.input,t.begin,r,t.file),this.variable=t,this.props=i,this.propertyName=this.variable instanceof U?this.variable.getText():It(this.variable.getText())}},_e=class extends _{constructor(t,i,r,s,n,o){super(f.Filter,r,s,n,o),this.name=t,this.args=i}},ke=class extends _{constructor(t,i,r,s,n,o){super(f.Hash,t,i,r,o),this.input=t,this.begin=i,this.end=r,this.name=s,this.value=n,this.file=o}},qe=class extends _{constructor(t,i,r,s){super(f.Quoted,t,i,r,s),this.input=t,this.begin=i,this.end=r,this.file=s}},se=class extends _{constructor(t,i,r,s){super(f.HTML,t,i,r,s),this.input=t,this.begin=i,this.end=r,this.file=s,this.trimLeft=0,this.trimRight=0}getContent(){return this.input.slice(this.begin+this.trimLeft,this.end-this.trimRight)}},Se=class extends _{constructor(t,i,r,s,n,o){super(f.Range,t,i,r,o),this.input=t,this.begin=i,this.end=r,this.lhs=s,this.rhs=n,this.file=o}},ve=class extends Q{constructor(t,i,r,s,n){let{trimOutputLeft:o,trimOutputRight:l,outputDelimiterLeft:a,outputDelimiterRight:u}=s,p=t.slice(i+a.length,r-u.length);super(f.Output,p,t,i,r,o,l,n)}};function xr(e,t,i,r=e.length){let s=i,n=t,o;for(;s[e[n]]&&n<r;)s=s[e[n++]],s.end&&(o=s);return!o||o.needBoundary&&d[e.charCodeAt(n)]&He?-1:n}var Le=class extends Q{constructor(t,i,r,s,n){let o=t.slice(i,r);if(super(f.Tag,o,t,i,r,!1,!1,n),!/\S/.test(o))this.name="",this.args="";else{let l=new m(this.content,s.operatorsTrie);if(this.name=l.readTagName(),!this.name)throw new H("illegal liquid tag syntax",this);l.skipBlank(),this.args=l.remaining()}}},m=class{constructor(t,i=P.operatorsTrie,r=""){this.input=t,this.trie=i,this.file=r,this.p=0,this.rawBeginAt=-1,this.N=t.length}readExpression(){return new we(this.readExpressionTokens())}*readExpressionTokens(){let t=this.readValue();if(!!t)for(yield t;this.p<this.N;){let i=this.readOperator();if(!i)return;let r=this.readValue();if(!r)return;yield i,yield r}}readOperator(){this.skipBlank();let t=xr(this.input,this.p,this.trie);if(t!==-1)return new be(this.input,this.p,this.p=t,this.file)}readFilters(){let t=[];for(;;){let i=this.readFilter();if(!i)return t;t.push(i)}}readFilter(){if(this.skipBlank(),this.end())return null;g(this.peek()==="|",()=>`unexpected token at ${this.snapshot()}`),this.p++;let t=this.p,i=this.readIdentifier();if(!i.size())return null;let r=[];if(this.skipBlank(),this.peek()===":")do{++this.p;let s=this.readFilterArg();s&&r.push(s),this.skipBlank(),g(this.end()||this.peek()===","||this.peek()==="|",()=>`unexpected character ${this.snapshot()}`)}while(this.peek()===",");return new _e(i.getText(),r,this.input,t,this.p,this.file)}readFilterArg(){let t=this.readValue();if(!t)return;if(this.skipBlank(),this.peek()!==":")return t;++this.p;let i=this.readValue();return[t.getText(),i]}readTopLevelTokens(t=P){let i=[];for(;this.p<this.N;){let r=this.readTopLevelToken(t);i.push(r)}return Or(i,t),i}readTopLevelToken(t){let{tagDelimiterLeft:i,outputDelimiterLeft:r}=t;return this.rawBeginAt>-1?this.readEndrawOrRawContent(t):this.match(i)?this.readTagToken(t):this.match(r)?this.readOutputToken(t):this.readHTMLToken([i,r])}readHTMLToken(t){let i=this.p;for(;this.p<this.N&&!t.some(r=>this.match(r));)++this.p;return new se(this.input,i,this.p,this.file)}readTagToken(t=P){let{file:i,input:r}=this,s=this.p;if(this.readToDelimiter(t.tagDelimiterRight)===-1)throw this.mkError(`tag ${this.snapshot(s)} not closed`,s);let n=new ne(r,s,this.p,t,i);return n.name==="raw"&&(this.rawBeginAt=s),n}readToDelimiter(t){for(;this.p<this.N;){if(this.peekType()&st){this.readQuoted();continue}if(++this.p,this.rmatch(t))return this.p}return-1}readOutputToken(t=P){let{file:i,input:r}=this,{outputDelimiterRight:s}=t,n=this.p;if(this.readToDelimiter(s)===-1)throw this.mkError(`output ${this.snapshot(n)} not closed`,n);return new ve(r,n,this.p,t,i)}readEndrawOrRawContent(t){let{tagDelimiterLeft:i,tagDelimiterRight:r}=t,s=this.p,n=this.readTo(i)-i.length;for(;this.p<this.N;){if(this.readIdentifier().getText()!=="endraw"){n=this.readTo(i)-i.length;continue}for(;this.p<=this.N;){if(this.rmatch(r)){let o=this.p;return s===n?(this.rawBeginAt=-1,new ne(this.input,s,o,t,this.file)):(this.p=n,new se(this.input,s,n,this.file))}if(this.rmatch(i))break;this.p++}}throw this.mkError(`raw ${this.snapshot(this.rawBeginAt)} not closed`,s)}readLiquidTagTokens(t=P){let i=[];for(;this.p<this.N;){let r=this.readLiquidTagToken(t);r.name&&i.push(r)}return i}readLiquidTagToken(t){let{file:i,input:r}=this,s=this.p,n=this.N;return this.readToDelimiter(`
`)!==-1&&(n=this.p),new Le(r,s,n,t,i)}mkError(t,i){return new H(t,new U(this.input,i,this.N,this.file))}snapshot(t=this.p){return JSON.stringify(Dt(this.input.slice(t),16))}readWord(){return console.warn("Tokenizer#readWord() will be removed, use #readIdentifier instead"),this.readIdentifier()}readIdentifier(){this.skipBlank();let t=this.p;for(;this.peekType()&He;)++this.p;return new U(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){let i=[];for(;;){let r=this.readHash(t);if(!r)return i;i.push(r)}}readHash(t){this.skipBlank(),this.peek()===","&&++this.p;let i=this.p,r=this.readIdentifier();if(!r.size())return;let s;this.skipBlank();let n=t?"=":":";return this.peek()===n&&(++this.p,s=this.readValue()),new ke(this.input,i,this.p,r,s,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<this.N;)if(++this.p,this.rmatch(t))return this.p;return-1}readValue(){let t=this.readQuoted()||this.readRange();if(t)return t;if(this.peek()==="["){this.p++;let n=this.readQuoted();return!n||this.peek()!=="]"?void 0:(this.p++,new re(n,[],this.p))}let i=this.readIdentifier();if(!i.size())return;let r=i.isNumber(!0),s=[];for(;;)if(this.peek()==="["){r=!1,this.p++;let n=this.readValue()||new U(this.input,this.p,this.p,this.file);this.readTo("]"),s.push(n)}else if(this.peek()==="."&&this.peek(1)!=="."){this.p++;let n=this.readIdentifier();if(!n.size())break;n.isNumber()||(r=!1),s.push(n)}else break;return!s.length&&xt.hasOwnProperty(i.content)?new Te(this.input,i.begin,i.end,this.file):r?new ye(i,s[0]):new re(i,s,this.p)}readRange(){this.skipBlank();let t=this.p;if(this.peek()!=="(")return;++this.p;let i=this.readValueOrThrow();this.p+=2;let r=this.readValueOrThrow();return++this.p,new Se(this.input,t,this.p,i,r,this.file)}readValueOrThrow(){let t=this.readValue();return g(t,()=>`unexpected token ${this.snapshot()}, value expected`),t}readQuoted(){this.skipBlank();let t=this.p;if(!(this.peekType()&st))return;++this.p;let i=!1;for(;this.p<this.N&&(++this.p,!(this.input[this.p-1]===this.input[t]&&!i));)i?i=!1:this.input[this.p-1]==="\\"&&(i=!0);return new qe(this.input,t,this.p,this.file)}*readFileNameTemplate(t){let{outputDelimiterLeft:i}=t,r=[","," ",i],s=new Set(r);for(;this.p<this.N&&!s.has(this.peek());)yield this.match(i)?this.readOutputToken(t):this.readHTMLToken(r)}match(t){for(let i=0;i<t.length;i++)if(t[i]!==this.input[this.p+i])return!1;return!0}rmatch(t){for(let i=0;i<t.length;i++)if(t[t.length-1-i]!==this.input[this.p-1-i])return!1;return!0}peekType(t=0){return d[this.input.charCodeAt(this.p+t)]}peek(t=0){return this.input[this.p+t]}skipBlank(){for(;this.peekType()&ae;)++this.p}},ne=class extends Q{constructor(t,i,r,s,n){let{trimTagLeft:o,trimTagRight:l,tagDelimiterLeft:a,tagDelimiterRight:u}=s,p=t.slice(i+a.length,r-u.length);super(f.Tag,p,t,i,r,o,l,n);let y=new m(this.content,s.operatorsTrie);if(this.name=y.readTagName(),!this.name)throw new H("illegal tag syntax",this);y.skipBlank(),this.args=y.remaining()}},Oe=class{constructor(t,i){this.handlers={},this.stopRequested=!1,this.tokens=t,this.parseToken=i}on(t,i){return this.handlers[t]=i,this}trigger(t,i){let r=this.handlers[t];return r?(r.call(this,i),!0):!1}start(){this.trigger("start");let t;for(;!this.stopRequested&&(t=this.tokens.shift());){if(this.trigger("token",t)||Je(t)&&this.trigger(`tag:${t.name}`,t))continue;let i=this.parseToken(t,this.tokens);this.trigger("template",i)}return this.stopRequested||this.trigger("end"),this}stop(){return this.stopRequested=!0,this}},I=class{constructor(t,i){this.hash={};let r=new m(t,{});for(let s of r.readHashes(i))this.hash[s.name.content]=s.value}*render(t){let i={};for(let r of Object.keys(this.hash))i[r]=this.hash[r]===void 0?!0:yield w(this.hash[r],t);return i}};function Ir(e){return T(e)}var Y=class{constructor(t,i,r,s){this.name=t,this.impl=i||yt,this.args=r,this.liquid=s}*render(t,i){let r=[];for(let s of this.args)Ir(s)?r.push([s[0],yield w(s[1],i)]):r.push(yield w(s,i));return this.impl.apply({context:i,liquid:this.liquid},[t,...r])}},S=class{constructor(t,i){this.filters=[];let r=new m(t,i.options.operatorsTrie);this.initial=r.readExpression(),this.filters=r.readFilters().map(({name:s,args:n})=>new Y(s,i.filters.get(s),n,i))}*value(t,i){i=i||t.opts.lenientIf&&this.filters.length>0&&this.filters[0].name==="default";let r=yield this.initial.evaluate(t,i);for(let s of this.filters)r=yield s.render(r,t);return r}},Er={parse:function(e){let t=new m(e.args,this.liquid.options.operatorsTrie);this.key=t.readIdentifier().content,t.skipBlank(),g(t.peek()==="=",()=>`illegal token ${e.getText()}`),t.advance(),this.value=new S(t.remaining(),this.liquid)},render:function*(e){e.bottom()[this.key]=yield this.value.value(e,this.liquid.options.lenientIf)}},J=class extends x{constructor(t,i,r){super(),this.i=0,this.length=t,this.name=`${r}-${i}`}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)}},pt=["offset","limit","reversed"],Pr={type:"block",parse:function(e,t){let i=new m(e.args,this.liquid.options.operatorsTrie),r=i.readIdentifier(),s=i.readIdentifier(),n=i.readValue();g(r.size()&&s.content==="in"&&n,()=>`illegal tag: ${e.getText()}`),this.variable=r.content,this.collection=n,this.hash=new I(i.remaining()),this.templates=[],this.elseTemplates=[];let o,l=this.liquid.parser.parseStream(t).on("start",()=>o=this.templates).on("tag:else",()=>o=this.elseTemplates).on("tag:endfor",()=>l.stop()).on("template",a=>o.push(a)).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)});l.start()},render:function*(e,t){let i=this.liquid.renderer,r=Qe(yield w(this.collection,e));if(!r.length){yield i.renderTemplates(this.elseTemplates,e,t);return}let s="continue-"+this.variable+"-"+this.collection.getText();e.push({continue:e.getRegister(s)});let n=yield this.hash.render(e);e.pop(),r=(this.liquid.options.orderedFilterParameters?Object.keys(n).filter(a=>pt.includes(a)):pt.filter(a=>n[a]!==void 0)).reduce((a,u)=>u==="offset"?Mr(a,n.offset):u==="limit"?Ar(a,n.limit):Nr(a),r),e.setRegister(s,(n.offset||0)+r.length);let l={forloop:new J(r.length,this.collection.getText(),this.variable)};e.push(l);for(let a of r){if(l[this.variable]=a,yield i.renderTemplates(this.templates,e,t),t.break){t.break=!1;break}t.continue=!1,l.forloop.next()}e.pop()}};function Nr(e){return[...e].reverse()}function Mr(e,t){return e.slice(t)}function Ar(e,t){return e.slice(0,t)}var $r={parse:function(e,t){let i=new m(e.args,this.liquid.options.operatorsTrie);this.variable=Cr(i),g(this.variable,()=>`${e.args} not valid identifier`),this.templates=[];let r=this.liquid.parser.parseStream(t);r.on("tag:endcapture",()=>r.stop()).on("template",s=>this.templates.push(s)).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)}),r.start()},render:function*(e){let i=yield this.liquid.renderer.renderTemplates(this.templates,e);e.bottom()[this.variable]=i}};function Cr(e){let t=e.readIdentifier().content;if(t)return t;let i=e.readQuoted();if(i)return Ge(i)}var Ur={parse:function(e,t){this.cond=new S(e.args,this.liquid),this.cases=[],this.elseTemplates=[];let i=[],r=this.liquid.parser.parseStream(t).on("tag:when",s=>{i=[];let n=new m(s.args,this.liquid.options.operatorsTrie);for(;!n.end();){let o=n.readValue();this.cases.push({val:o,templates:i}),n.readTo(",")}}).on("tag:else",()=>i=this.elseTemplates).on("tag:endcase",()=>r.stop()).on("template",s=>i.push(s)).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)});r.start()},render:function*(e,t){let i=this.liquid.renderer,r=h(yield this.cond.value(e,e.opts.lenientIf));for(let s of this.cases)if((yield w(s.val,e,e.opts.lenientIf))===r){yield i.renderTemplates(s.templates,e,t);return}yield i.renderTemplates(this.elseTemplates,e,t)}},zr={parse:function(e,t){let i=this.liquid.parser.parseStream(t);i.on("token",r=>{r.name==="endcomment"&&i.stop()}).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)}),i.start()}},Fe;(function(e){e[e.OUTPUT=0]="OUTPUT",e[e.STORE=1]="STORE"})(Fe||(Fe={}));var j=Fe,Dr={parseFilePath:Ze,renderFilePath:Xe,parse:function(e){let t=e.args,i=new m(t,this.liquid.options.operatorsTrie);for(this.file=this.parseFilePath(i,this.liquid),this.currentFile=e.file;!i.end();){i.skipBlank();let r=i.p,s=i.readIdentifier();if((s.content==="with"||s.content==="for")&&(i.skipBlank(),i.peek()!==":")){let n=i.readValue();if(n){let o=i.p,l=i.readIdentifier(),a;l.content==="as"?a=i.readIdentifier():i.p=o,this[s.content]={value:n,alias:a&&a.content},i.skipBlank(),i.peek()===","&&i.advance();continue}}i.p=r;break}this.hash=new I(i.remaining())},render:function*(e,t){let{liquid:i,hash:r}=this,s=yield this.renderFilePath(this.file,e,i);g(s,()=>`illegal filename "${s}"`);let n=new $({},e.opts,{sync:e.sync,globals:e.globals,strictVariables:e.strictVariables}),o=n.bottom();if(X(o,yield r.render(e)),this.with){let{value:l,alias:a}=this.with;o[a||s]=yield w(l,e)}if(this.for){let{value:l,alias:a}=this.for,u=yield w(l,e);u=Qe(u),o.forloop=new J(u.length,l.getText(),a);for(let p of u){o[a]=p;let y=yield i._parsePartialFile(s,n.sync,this.currentFile);yield i.renderer.renderTemplates(y,n,t),o.forloop.next()}}else{let l=yield i._parsePartialFile(s,n.sync,this.currentFile);yield i.renderer.renderTemplates(l,n,t)}}};function Ze(e,t){if(t.options.dynamicPartials){let s=e.readValue();if(s===void 0)throw new TypeError(`illegal argument "${e.input}"`);if(s.getText()==="none")return null;if(Rt(s)){let n=t.parse(Ge(s));return dt(n)}return s}let i=[...e.readFileNameTemplate(t.options)],r=dt(t.parser.parseTokens(i));return r==="none"?null:r}function dt(e){return e.length===1&&Ye(e[0].token)?e[0].token.getContent():e}function*Xe(e,t,i){return typeof e=="string"?e:Array.isArray(e)?i.renderer.renderTemplates(e,t):yield w(e,t)}var Wr={parseFilePath:Ze,renderFilePath:Xe,parse:function(e){let t=e.args,i=new m(t,this.liquid.options.operatorsTrie);this.file=this.parseFilePath(i,this.liquid),this.currentFile=e.file;let r=i.p;i.readIdentifier().content==="with"?(i.skipBlank(),i.peek()!==":"?this.withVar=i.readValue():i.p=r):i.p=r,this.hash=new I(i.remaining(),this.liquid.options.jekyllInclude)},render:function*(e,t){let{liquid:i,hash:r,withVar:s}=this,{renderer:n}=i,o=yield this.renderFilePath(this.file,e,i);g(o,()=>`illegal filename "${o}"`);let l=e.saveRegister("blocks","blockMode");e.setRegister("blocks",{}),e.setRegister("blockMode",j.OUTPUT);let a=yield r.render(e);s&&(a[o]=yield w(s,e));let u=yield i._parsePartialFile(o,e.sync,this.currentFile);e.push(e.opts.jekyllInclude?{include:a}:a),yield n.renderTemplates(u,e,t),e.pop(),e.restoreRegister(l)}},Vr={parse:function(e){let t=new m(e.args,this.liquid.options.operatorsTrie);this.variable=t.readIdentifier().content},render:function(e,t){let i=e.environments;De(i[this.variable])||(i[this.variable]=0),t.write(c(--i[this.variable]))}},Br={parse:function(e){let t=new m(e.args,this.liquid.options.operatorsTrie),i=t.readValue();for(t.skipBlank(),this.candidates=[],i&&(t.peek()===":"?(this.group=i,t.advance()):this.candidates.push(i));!t.end();){let r=t.readValue();r&&this.candidates.push(r),t.readTo(",")}g(this.candidates.length,()=>`empty candidates: ${e.getText()}`)},render:function*(e,t){let r=`cycle:${yield w(this.group,e)}:`+this.candidates.join(","),s=e.getRegister("cycle"),n=s[r];n===void 0&&(n=s[r]=0);let o=this.candidates[n];n=(n+1)%this.candidates.length,s[r]=n;let l=yield w(o,e);t.write(l)}},jr={parse:function(e,t){this.branches=[],this.elseTemplates=[];let i;this.liquid.parser.parseStream(t).on("start",()=>this.branches.push({predicate:new S(e.args,this.liquid),templates:i=[]})).on("tag:elsif",r=>this.branches.push({predicate:new S(r.args,this.liquid),templates:i=[]})).on("tag:else",()=>i=this.elseTemplates).on("tag:endif",function(){this.stop()}).on("template",r=>i.push(r)).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)}).start()},render:function*(e,t){let i=this.liquid.renderer;for(let{predicate:r,templates:s}of this.branches){let n=yield r.value(e,e.opts.lenientIf);if(N(n,e)){yield i.renderTemplates(s,e,t);return}}yield i.renderTemplates(this.elseTemplates,e,t)}},Hr={parse:function(e){let t=new m(e.args,this.liquid.options.operatorsTrie);this.variable=t.readIdentifier().content},render:function(e,t){let i=e.environments;De(i[this.variable])||(i[this.variable]=0);let r=i[this.variable];i[this.variable]++,t.write(c(r))}},Qr={parseFilePath:Ze,renderFilePath:Xe,parse:function(e,t){let i=new m(e.args,this.liquid.options.operatorsTrie);this.file=this.parseFilePath(i,this.liquid),this.currentFile=e.file,this.hash=new I(i.remaining()),this.tpls=this.liquid.parser.parseTokens(t)},render:function*(e,t){let{liquid:i,hash:r,file:s}=this,{renderer:n}=i;if(s===null){e.setRegister("blockMode",j.OUTPUT),yield n.renderTemplates(this.tpls,e,t);return}let o=yield this.renderFilePath(this.file,e,i);g(o,()=>`illegal filename "${o}"`);let l=yield i._parseLayoutFile(o,e.sync,this.currentFile);e.setRegister("blockMode",j.STORE);let a=yield n.renderTemplates(this.tpls,e),u=e.getRegister("blocks");u[""]===void 0&&(u[""]=(p,y)=>y.write(a)),e.setRegister("blockMode",j.OUTPUT),e.push(yield r.render(e)),yield n.renderTemplates(l,e,t),e.pop()}},oe=class extends x{constructor(t=()=>""){super(),this.superBlockRender=t}super(){return this.superBlockRender()}},Yr={parse(e,t){let i=/\w+/.exec(e.args);this.block=i?i[0]:"",this.tpls=[],this.liquid.parser.parseStream(t).on("tag:endblock",function(){this.stop()}).on("template",r=>this.tpls.push(r)).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)}).start()},*render(e,t){let i=this.getBlockRender(e);e.getRegister("blockMode")===j.STORE?e.getRegister("blocks")[this.block]=i:yield i(new oe,t)},getBlockRender(e){let{liquid:t,tpls:i}=this,r=e.getRegister("blocks")[this.block],s=function*(n,o){e.push({block:n}),yield t.renderer.renderTemplates(i,e,o),e.pop()};return r?(n,o)=>r(new oe(()=>s(n,o)),o):s}},Jr={parse:function(e,t){this.tokens=[];let i=this.liquid.parser.parseStream(t);i.on("token",r=>{r.name==="endraw"?i.stop():this.tokens.push(r)}).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)}),i.start()},render:function(){return this.tokens.map(e=>e.getText()).join("")}},Re=class extends J{constructor(t,i,r,s){super(t,r,s),this.length=t,this.cols=i}row(){return Math.floor(this.i/this.cols)+1}col0(){return this.i%this.cols}col(){return this.col0()+1}col_first(){return this.col0()===0}col_last(){return this.col()===this.cols}},Gr={parse:function(e,t){let i=new m(e.args,this.liquid.options.operatorsTrie),r=i.readIdentifier();i.skipBlank();let s=i.readIdentifier();g(s&&s.content==="in",()=>`illegal tag: ${e.getText()}`),this.variable=r.content,this.collection=i.readValue(),this.hash=new I(i.remaining()),this.templates=[];let n,o=this.liquid.parser.parseStream(t).on("start",()=>n=this.templates).on("tag:endtablerow",()=>o.stop()).on("template",l=>n.push(l)).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)});o.start()},render:function*(e,t){let i=Qe(yield w(this.collection,e)),r=yield this.hash.render(e),s=r.offset||0,n=r.limit===void 0?i.length:r.limit;i=i.slice(s,s+n);let o=r.cols||i.length,l=this.liquid.renderer,a=new Re(i.length,o,this.collection.getText(),this.variable),u={tablerowloop:a};e.push(u);for(let p=0;p<i.length;p++,a.next())u[this.variable]=i[p],a.col0()===0&&(a.row()!==1&&t.write("</tr>"),t.write(`<tr class="row${a.row()}">`)),t.write(`<td class="col${a.col()}">`),yield l.renderTemplates(this.templates,e,t),t.write("</td>");i.length&&t.write("</tr>"),e.pop()}},Zr={parse:function(e,t){this.branches=[],this.elseTemplates=[];let i;this.liquid.parser.parseStream(t).on("start",()=>this.branches.push({predicate:new S(e.args,this.liquid),test:je,templates:i=[]})).on("tag:elsif",r=>this.branches.push({predicate:new S(r.args,this.liquid),test:N,templates:i=[]})).on("tag:else",()=>i=this.elseTemplates).on("tag:endunless",function(){this.stop()}).on("template",r=>i.push(r)).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)}).start()},render:function*(e,t){let i=this.liquid.renderer;for(let{predicate:r,test:s,templates:n}of this.branches){let o=yield r.value(e,e.opts.lenientIf);if(s(o,e)){yield i.renderTemplates(n,e,t);return}}yield i.renderTemplates(this.elseTemplates,e,t)}},Xr={render:function(e,t){t.break=!0}},Kr={render:function(e,t){t.continue=!0}},es={parse:function(e){this.value=new S(e.args,this.liquid)},render:function*(e,t){let i=yield this.value.value(e,!1);t.write(i)}},ts={parse:function(e){let i=new m(e.args,this.liquid.options.operatorsTrie).readLiquidTagTokens(this.liquid.options);this.tpls=this.liquid.parser.parseTokens(i)},render:function*(e,t){yield this.liquid.renderer.renderTemplates(this.tpls,e,t)}},is={parse:function(e,t){if(e.args.search(/\n\s*[^#\s]/g)!==-1)throw new Error("every line of an inline comment must start with a '#' character")}},rs={assign:Er,for:Pr,capture:$r,case:Ur,comment:zr,include:Wr,render:Dr,decrement:Vr,increment:Hr,cycle:Br,if:jr,layout:Qr,block:Yr,raw:Jr,tablerow:Gr,unless:Zr,break:Xr,continue:Kr,echo:es,liquid:ts,"#":is};var Et=new Map;le(Ot,(e,t)=>{Et.set(ue(t),e)});var P={root:["."],layouts:["."],partials:["."],relativeReference:!0,jekyllInclude:!1,cache:void 0,extname:"",fs:Jt,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:rt,operatorsTrie:_t(rt)};function ss(e){if(e.hasOwnProperty("operators")&&(e.operatorsTrie=_t(e.operators)),e.hasOwnProperty("root")&&(e.hasOwnProperty("partials")||(e.partials=e.root),e.hasOwnProperty("layouts")||(e.layouts=e.root)),e.hasOwnProperty("cache")){let t;typeof e.cache=="number"?t=e.cache>0?new te(e.cache):void 0:typeof e.cache=="object"?t=e.cache:t=e.cache?new te(1024):void 0,e.cache=t}return e=Object.assign(Object.assign(Object.assign({},P),e.jekyllInclude?{dynamicPartials:!1}:{}),e),!e.fs.dirname&&e.relativeReference&&(console.warn("[LiquidJS] `fs.dirname` is required for relativeReference, set relativeReference to `false` to suppress this warning, or provide implementation for `fs.dirname`"),e.relativeReference=!1),e.root=Z(e.root),e.partials=Z(e.partials),e.layouts=Z(e.layouts),e.outputEscape=e.outputEscape&&ns(e.outputEscape),e}function ns(e){if(L(e)){let t=Et.get(e);return g(q(t),`filter "${e}" not found`),t}else return g(q(e),"`outputEscape` need to be of type string or function"),e}function Z(e){let t=[];return T(e)&&(t=e),L(e)&&(t=[e]),t}var $=class{constructor(t={},i=P,r={}){var s,n;this.scopes=[{}],this.registers={},this.sync=!!r.sync,this.opts=i,this.globals=(s=r.globals)!==null&&s!==void 0?s:i.globals,this.environments=t,this.strictVariables=(n=r.strictVariables)!==null&&n!==void 0?n:this.opts.strictVariables}getRegister(t){return this.registers[t]=this.registers[t]||{}}setRegister(t,i){return this.registers[t]=i}saveRegister(...t){return t.map(i=>[i,this.getRegister(i)])}restoreRegister(t){return t.forEach(([i,r])=>this.setRegister(i,r))}getAll(){return[this.globals,this.environments,...this.scopes].reduce((t,i)=>X(t,i),{})}get(t){return A(this._get(t))}*_get(t){let i=this.findScope(t[0]);return yield this._getFromScope(i,t)}getFromScope(t,i){return A(this._getFromScope(t,i))}*_getFromScope(t,i){L(i)&&(i=i.split("."));for(let r=0;r<i.length;r++)if(t=yield os(t,i[r],this.opts.ownPropertyOnly),E(t)&&this.strictVariables)throw new de(i.slice(0,r+1).join("."));return t}push(t){return this.scopes.push(t)}pop(){return this.scopes.pop()}bottom(){return this.scopes[0]}findScope(t){for(let i=this.scopes.length-1;i>=0;i--){let r=this.scopes[i];if(t in r)return r}return t in this.environments?this.environments:this.globals}};function os(e,t,i){if(E(e))return e;if(e=gt(e),T(e)&&t<0)return e[e.length+ +t];let r=as(e,t,i);return r===void 0&&e instanceof x?e.liquidMethodMissing(t):q(r)?r.call(e):t==="size"?cs(e):t==="first"?ls(e):t==="last"?us(e):r}function as(e,t,i){if(!(i&&!Object.hasOwnProperty.call(e,t)))return e[t]}function ls(e){return T(e)?e[0]:e.first}function us(e){return T(e)?e[e.length-1]:e.last}function cs(e){if(e.hasOwnProperty("size")||e.size!==void 0)return e.size;if(T(e)||L(e))return e.length;if(typeof e=="object")return Object.keys(e).length}var C;(function(e){e.Partials="partials",e.Layouts="layouts",e.Root="root"})(C||(C={}));var xe=class{constructor(t){if(this.options=t,t.relativeReference){let i=t.fs.sep;g(i,"`fs.sep` is required for relative reference");let r=new RegExp(["."+i,".."+i,"./","../"].map(s=>$t(s)).join("|"));this.shouldLoadRelative=s=>r.test(s)}else this.shouldLoadRelative=i=>!1;this.contains=this.options.fs.contains||(()=>!0)}*lookup(t,i,r,s){let{fs:n}=this.options,o=this.options[i];for(let l of this.candidates(t,o,s,i!==C.Root))if(r?n.existsSync(l):yield n.exists(l))return l;throw this.lookupError(t,o)}*candidates(t,i,r,s){let{fs:n,extname:o}=this.options;if(this.shouldLoadRelative(t)&&r){let l=n.resolve(this.dirname(r),t,o);for(let a of i)if(!s||this.contains(a,l)){yield l;break}}for(let l of i){let a=n.resolve(l,t,o);(!s||this.contains(l,a))&&(yield a)}if(n.fallback!==void 0){let l=n.fallback(t);l!==void 0&&(yield l)}}dirname(t){let i=this.options.fs;return g(i.dirname,"`fs.dirname` is required for relative reference"),i.dirname(t)}lookupError(t,i){let r=new Error("ENOENT");return r.message=`ENOENT: Failed to lookup "${t}" in "${i}"`,r.code="ENOENT",r}},Ie=class{constructor(){this.buffer=""}write(t){this.buffer+=c(t)}},Ee=class{constructor(){throw this.buffer="",this.stream=null,new Error("streaming not supported in browser")}},Pe=class{constructor(){this.buffer=""}write(t){t=h(t),typeof t!="string"&&this.buffer===""?this.buffer=t:this.buffer=c(this.buffer)+c(t)}},Ne=class{renderTemplatesToNodeStream(t,i){let r=new Ee;return Promise.resolve().then(()=>M(this.renderTemplates(t,i,r))).then(()=>r.end(),s=>r.error(s)),r.stream}*renderTemplates(t,i,r){r||(r=i.opts.keepOutputType?new Pe:new Ie);for(let s of t)try{let n=yield s.render(i,r);if(n&&r.write(n),r.break||r.continue)break}catch(n){throw ie.is(n)?n:new ie(n,s)}return r.buffer}},G=class{constructor(t){this.token=t}},Me=class extends G{constructor(t,i,r){super(t),this.name=t.name;let s=r.tags.get(t.name);this.impl=Object.create(s),this.impl.liquid=r,this.impl.parse&&this.impl.parse(t,i)}*render(t,i){let r=yield new I(this.token.args).render(t),s=this.impl;if(q(s.render))return yield s.render(t,i,r)}},Ae=class extends G{constructor(t,i){super(t),this.value=new S(t.content,i);let r=this.value.filters,s=i.options.outputEscape;r.length&&r[r.length-1].name==="raw"?r.pop():s&&r.push(new Y(toString.call(s),s,[],i))}*render(t,i){let r=yield this.value.value(t,!1);i.write(r)}},$e=class extends G{constructor(t){super(t),this.str=t.getContent()}*render(t,i){i.write(this.str)}},Ce=class{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 xe(this.liquid.options)}parse(t,i){let s=new m(t,this.liquid.options.operatorsTrie,i).readTopLevelTokens(this.liquid.options);return this.parseTokens(s)}parseTokens(t){let i,r=[];for(;i=t.shift();)r.push(this.parseToken(i,t));return r}parseToken(t,i){try{return Je(t)?new Me(t,i,this.liquid):fr(t)?new Ae(t,this.liquid):new $e(t)}catch(r){throw new he(r,t)}}parseStream(t){return new Oe(t,(i,r)=>this.parseToken(i,r))}*_parseFileCached(t,i,r=C.Root,s){let n=this.cache,o=this.loader.shouldLoadRelative(t)?s+","+t:r+":"+t,l=yield n.read(o);if(l)return l;let a=this._parseFile(t,i,r,s),u=i?yield a:M(a);n.write(o,u);try{return yield u}catch(p){throw n.remove(o),p}}*_parseFile(t,i,r=C.Root,s){let n=yield this.loader.lookup(t,r,i,s);return this.liquid.parse(i?this.fs.readFileSync(n):yield this.fs.readFile(n),n)}},Ue=class{constructor(){this.impls={}}get(t){let i=this.impls[t];return g(i,()=>`tag "${t}" not found`),i}set(t,i){this.impls[t]=i}},ze=class{constructor(t,i){this.strictFilters=t,this.liquid=i,this.impls={}}get(t){let i=this.impls[t];return g(i||!this.strictFilters,()=>`undefined filter: ${t}`),i}set(t,i){this.impls[t]=i}create(t,i){return new Y(t,this.get(t),i,this.liquid)}};var W=class{constructor(t={}){this.options=ss(t),this.parser=new Ce(this),this.renderer=new Ne,this.filters=new ze(this.options.strictFilters,this),this.tags=new Ue,le(rs,(i,r)=>this.registerTag(ue(r),i)),le(Ot,(i,r)=>this.registerFilter(ue(r),i))}parse(t,i){return this.parser.parse(t,i)}_render(t,i,r){let s=new $(i,this.options,r);return this.renderer.renderTemplates(t,s)}render(t,i,r){return O(this,void 0,void 0,function*(){return M(this._render(t,i,Object.assign(Object.assign({},r),{sync:!1})))})}renderSync(t,i,r){return A(this._render(t,i,Object.assign(Object.assign({},r),{sync:!0})))}renderToNodeStream(t,i,r={}){let s=new $(i,this.options,r);return this.renderer.renderTemplatesToNodeStream(t,s)}_parseAndRender(t,i,r){let s=this.parse(t);return this._render(s,i,r)}parseAndRender(t,i,r){return O(this,void 0,void 0,function*(){return M(this._parseAndRender(t,i,Object.assign(Object.assign({},r),{sync:!1})))})}parseAndRenderSync(t,i,r){return A(this._parseAndRender(t,i,Object.assign(Object.assign({},r),{sync:!0})))}_parsePartialFile(t,i,r){return this.parser.parseFile(t,i,C.Partials,r)}_parseLayoutFile(t,i,r){return this.parser.parseFile(t,i,C.Layouts,r)}parseFile(t){return O(this,void 0,void 0,function*(){return M(this.parser.parseFile(t,!1))})}parseFileSync(t){return A(this.parser.parseFile(t,!0))}renderFile(t,i,r){return O(this,void 0,void 0,function*(){let s=yield this.parseFile(t);return this.render(s,i,r)})}renderFileSync(t,i,r){let s=this.parseFileSync(t);return this.renderSync(s,i,r)}renderFileToNodeStream(t,i,r){return O(this,void 0,void 0,function*(){let s=yield this.parseFile(t);return this.renderToNodeStream(s,i,r)})}_evalValue(t,i){let r=new S(t,this),s=i instanceof $?i:new $(i,this.options);return r.value(s,!1)}evalValue(t,i){return O(this,void 0,void 0,function*(){return M(this._evalValue(t,i))})}evalValueSync(t,i){return A(this._evalValue(t,i))}registerFilter(t,i){this.filters.set(t,i)}registerTag(t,i){this.tags.set(t,i)}plugin(t){return t.call(this,W)}express(){let t=this,i=!0;return function(r,s,n){if(i){i=!1;let o=Z(this.root);t.options.root.unshift(...o),t.options.layouts.unshift(...o),t.options.partials.unshift(...o)}t.renderFile(r,s).then(o=>n(null,o),n)}}};import{html as hs,unsafeStatic as ps}from"https://cdn.jsdelivr.net/npm/lit-html@2.4.0/static/+esm";var Ke=e=>function(){let t=(a,u)=>e.utils.url.getVariantUrl(a.url,u==null?void 0:u.id),i=(a,...u)=>e.utils.url.getImageUrl(a,Pt(u)),r=(a="")=>e.utils.url.getFileUrl(a),s=(a="",u)=>e.utils.url.getImageUrl({src:e.utils.url.getFileUrl(a.replace(".",`_${u}.`))}),n=a=>e.utils.money.formatMoney(a),o=(a,...u)=>{try{return u.length?this.parseAndRenderSync(e.theme.translate(a),Pt(u)):e.theme.translate(a)}catch(p){return a}},l=(a="")=>a.toLowerCase().trim().replace(/[^a-zA-Z0-9]/g,"-").replace(/[-]{2,}/g,"-");this.registerFilter("variant_url",t),this.registerFilter("image_url",i),this.registerFilter("file_url",r),this.registerFilter("file_img_url",s),this.registerFilter("money",n),this.registerFilter("t",o),this.registerFilter("handle",l),this.registerFilter("handleize",l)},Pt=e=>e.reduce((t,[i,r])=>r?{...t,[i]:r}:t,{});import{WishlistElement as ds}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.4/wishlist-element.js";var et=class extends ds{constructor(){super();this.initLiquid()}static get properties(){return{}}async initLiquid(){await this.app.load(),this.dataUtil=new V,this.globals={settings:{login_required:this.app.settings.general.wishlistAccessMode!=="UNRESTRICTED"},customer:this.app.customer,shop:{currency:this.app.config.shop.currency,customer_accounts_enabled:this.app.config.shop.customerAccountsEnabled,domain:this.app.config.shop.domain,money_format:this.app.config.shop.moneyFormat,name:this.app.config.shop.name,permanent_domain:this.app.config.shop.permanentDomain},routes:{root_url:this.app.routes.rootUrl,wishlist_url:this.app.routes.wishlistUrl,account_url:this.app.routes.accountUrl,account_login_url:this.app.routes.accountLoginUrl,account_logout_url:this.app.routes.accountLogoutUrl,account_register_url:this.app.routes.accountRegisterUrl,account_addresses_url:this.app.routes.accountAddressesUrl,collections_url:this.app.routes.collectionsUrl,all_products_collection_url:this.app.routes.allProductsCollectionUrl,search_url:this.app.routes.searchUrl,predictive_search_url:this.app.routes.predictiveSearchUrl,cart_url:this.app.routes.cartUrl,cart_add_url:this.app.routes.cartAddUrl,cart_change_url:this.app.routes.cartChangeUrl,cart_clear_url:this.app.routes.cartClearUrl,cart_update_url:this.app.routes.cartUpdateUrl,product_recommendations_url:this.app.routes.productRecommendationsUrl}},this.liquidEngine=new W({cache:!0,relativeReference:!1}),this.liquidEngine.plugin(Ke(this.app)),this.parsedTemplates=this.liquidEngine.parse(this.getLiquidTemplate()),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),this.parsedTemplates=void 0}getLiquidTemplate(){return""}getLiquidData(){return{}}render(){var l;if(!this.parsedTemplates||!this.liquidEngine||!this.dataUtil)return;let{wishlist:i,wishlistItem:r,productInfo:s}=(l=this.state)!=null?l:{},n={...this.dataUtil.objectToSnakeCase(this.getLiquidData()),wishlist:i?this.dataUtil.mapWishlistState(i):void 0,wishlist_item:r?this.dataUtil.mapWishlistItem(r):void 0,product_info:s?this.dataUtil.mapProductInfo(s):void 0},o=this.liquidEngine.renderSync(this.parsedTemplates,n,{globals:this.globals});return hs`${ps(o)}`}};export{V as LiquidDataUtil,et as LiquidElement,Ke as liquidShopifyFilters};
`)!==-1&&(n=this.p),new Le(r,s,n,t,i)}mkError(t,i){return new H(t,new U(this.input,i,this.N,this.file))}snapshot(t=this.p){return JSON.stringify(Dt(this.input.slice(t),16))}readWord(){return console.warn("Tokenizer#readWord() will be removed, use #readIdentifier instead"),this.readIdentifier()}readIdentifier(){this.skipBlank();let t=this.p;for(;this.peekType()&He;)++this.p;return new U(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){let i=[];for(;;){let r=this.readHash(t);if(!r)return i;i.push(r)}}readHash(t){this.skipBlank(),this.peek()===","&&++this.p;let i=this.p,r=this.readIdentifier();if(!r.size())return;let s;this.skipBlank();let n=t?"=":":";return this.peek()===n&&(++this.p,s=this.readValue()),new ke(this.input,i,this.p,r,s,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<this.N;)if(++this.p,this.rmatch(t))return this.p;return-1}readValue(){let t=this.readQuoted()||this.readRange();if(t)return t;if(this.peek()==="["){this.p++;let n=this.readQuoted();return!n||this.peek()!=="]"?void 0:(this.p++,new re(n,[],this.p))}let i=this.readIdentifier();if(!i.size())return;let r=i.isNumber(!0),s=[];for(;;)if(this.peek()==="["){r=!1,this.p++;let n=this.readValue()||new U(this.input,this.p,this.p,this.file);this.readTo("]"),s.push(n)}else if(this.peek()==="."&&this.peek(1)!=="."){this.p++;let n=this.readIdentifier();if(!n.size())break;n.isNumber()||(r=!1),s.push(n)}else break;return!s.length&&xt.hasOwnProperty(i.content)?new Te(this.input,i.begin,i.end,this.file):r?new ye(i,s[0]):new re(i,s,this.p)}readRange(){this.skipBlank();let t=this.p;if(this.peek()!=="(")return;++this.p;let i=this.readValueOrThrow();this.p+=2;let r=this.readValueOrThrow();return++this.p,new Se(this.input,t,this.p,i,r,this.file)}readValueOrThrow(){let t=this.readValue();return g(t,()=>`unexpected token ${this.snapshot()}, value expected`),t}readQuoted(){this.skipBlank();let t=this.p;if(!(this.peekType()&st))return;++this.p;let i=!1;for(;this.p<this.N&&(++this.p,!(this.input[this.p-1]===this.input[t]&&!i));)i?i=!1:this.input[this.p-1]==="\\"&&(i=!0);return new qe(this.input,t,this.p,this.file)}*readFileNameTemplate(t){let{outputDelimiterLeft:i}=t,r=[","," ",i],s=new Set(r);for(;this.p<this.N&&!s.has(this.peek());)yield this.match(i)?this.readOutputToken(t):this.readHTMLToken(r)}match(t){for(let i=0;i<t.length;i++)if(t[i]!==this.input[this.p+i])return!1;return!0}rmatch(t){for(let i=0;i<t.length;i++)if(t[t.length-1-i]!==this.input[this.p-1-i])return!1;return!0}peekType(t=0){return d[this.input.charCodeAt(this.p+t)]}peek(t=0){return this.input[this.p+t]}skipBlank(){for(;this.peekType()&ae;)++this.p}},ne=class extends Q{constructor(t,i,r,s,n){let{trimTagLeft:o,trimTagRight:l,tagDelimiterLeft:a,tagDelimiterRight:u}=s,p=t.slice(i+a.length,r-u.length);super(f.Tag,p,t,i,r,o,l,n);let y=new m(this.content,s.operatorsTrie);if(this.name=y.readTagName(),!this.name)throw new H("illegal tag syntax",this);y.skipBlank(),this.args=y.remaining()}},Oe=class{constructor(t,i){this.handlers={},this.stopRequested=!1,this.tokens=t,this.parseToken=i}on(t,i){return this.handlers[t]=i,this}trigger(t,i){let r=this.handlers[t];return r?(r.call(this,i),!0):!1}start(){this.trigger("start");let t;for(;!this.stopRequested&&(t=this.tokens.shift());){if(this.trigger("token",t)||Je(t)&&this.trigger(`tag:${t.name}`,t))continue;let i=this.parseToken(t,this.tokens);this.trigger("template",i)}return this.stopRequested||this.trigger("end"),this}stop(){return this.stopRequested=!0,this}},I=class{constructor(t,i){this.hash={};let r=new m(t,{});for(let s of r.readHashes(i))this.hash[s.name.content]=s.value}*render(t){let i={};for(let r of Object.keys(this.hash))i[r]=this.hash[r]===void 0?!0:yield w(this.hash[r],t);return i}};function Ir(e){return T(e)}var Y=class{constructor(t,i,r,s){this.name=t,this.impl=i||yt,this.args=r,this.liquid=s}*render(t,i){let r=[];for(let s of this.args)Ir(s)?r.push([s[0],yield w(s[1],i)]):r.push(yield w(s,i));return this.impl.apply({context:i,liquid:this.liquid},[t,...r])}},S=class{constructor(t,i){this.filters=[];let r=new m(t,i.options.operatorsTrie);this.initial=r.readExpression(),this.filters=r.readFilters().map(({name:s,args:n})=>new Y(s,i.filters.get(s),n,i))}*value(t,i){i=i||t.opts.lenientIf&&this.filters.length>0&&this.filters[0].name==="default";let r=yield this.initial.evaluate(t,i);for(let s of this.filters)r=yield s.render(r,t);return r}},Er={parse:function(e){let t=new m(e.args,this.liquid.options.operatorsTrie);this.key=t.readIdentifier().content,t.skipBlank(),g(t.peek()==="=",()=>`illegal token ${e.getText()}`),t.advance(),this.value=new S(t.remaining(),this.liquid)},render:function*(e){e.bottom()[this.key]=yield this.value.value(e,this.liquid.options.lenientIf)}},J=class extends x{constructor(t,i,r){super(),this.i=0,this.length=t,this.name=`${r}-${i}`}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)}},pt=["offset","limit","reversed"],Pr={type:"block",parse:function(e,t){let i=new m(e.args,this.liquid.options.operatorsTrie),r=i.readIdentifier(),s=i.readIdentifier(),n=i.readValue();g(r.size()&&s.content==="in"&&n,()=>`illegal tag: ${e.getText()}`),this.variable=r.content,this.collection=n,this.hash=new I(i.remaining()),this.templates=[],this.elseTemplates=[];let o,l=this.liquid.parser.parseStream(t).on("start",()=>o=this.templates).on("tag:else",()=>o=this.elseTemplates).on("tag:endfor",()=>l.stop()).on("template",a=>o.push(a)).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)});l.start()},render:function*(e,t){let i=this.liquid.renderer,r=Qe(yield w(this.collection,e));if(!r.length){yield i.renderTemplates(this.elseTemplates,e,t);return}let s="continue-"+this.variable+"-"+this.collection.getText();e.push({continue:e.getRegister(s)});let n=yield this.hash.render(e);e.pop(),r=(this.liquid.options.orderedFilterParameters?Object.keys(n).filter(a=>pt.includes(a)):pt.filter(a=>n[a]!==void 0)).reduce((a,u)=>u==="offset"?Mr(a,n.offset):u==="limit"?Ar(a,n.limit):Nr(a),r),e.setRegister(s,(n.offset||0)+r.length);let l={forloop:new J(r.length,this.collection.getText(),this.variable)};e.push(l);for(let a of r){if(l[this.variable]=a,yield i.renderTemplates(this.templates,e,t),t.break){t.break=!1;break}t.continue=!1,l.forloop.next()}e.pop()}};function Nr(e){return[...e].reverse()}function Mr(e,t){return e.slice(t)}function Ar(e,t){return e.slice(0,t)}var $r={parse:function(e,t){let i=new m(e.args,this.liquid.options.operatorsTrie);this.variable=Cr(i),g(this.variable,()=>`${e.args} not valid identifier`),this.templates=[];let r=this.liquid.parser.parseStream(t);r.on("tag:endcapture",()=>r.stop()).on("template",s=>this.templates.push(s)).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)}),r.start()},render:function*(e){let i=yield this.liquid.renderer.renderTemplates(this.templates,e);e.bottom()[this.variable]=i}};function Cr(e){let t=e.readIdentifier().content;if(t)return t;let i=e.readQuoted();if(i)return Ge(i)}var Ur={parse:function(e,t){this.cond=new S(e.args,this.liquid),this.cases=[],this.elseTemplates=[];let i=[],r=this.liquid.parser.parseStream(t).on("tag:when",s=>{i=[];let n=new m(s.args,this.liquid.options.operatorsTrie);for(;!n.end();){let o=n.readValue();this.cases.push({val:o,templates:i}),n.readTo(",")}}).on("tag:else",()=>i=this.elseTemplates).on("tag:endcase",()=>r.stop()).on("template",s=>i.push(s)).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)});r.start()},render:function*(e,t){let i=this.liquid.renderer,r=h(yield this.cond.value(e,e.opts.lenientIf));for(let s of this.cases)if((yield w(s.val,e,e.opts.lenientIf))===r){yield i.renderTemplates(s.templates,e,t);return}yield i.renderTemplates(this.elseTemplates,e,t)}},zr={parse:function(e,t){let i=this.liquid.parser.parseStream(t);i.on("token",r=>{r.name==="endcomment"&&i.stop()}).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)}),i.start()}},Fe;(function(e){e[e.OUTPUT=0]="OUTPUT",e[e.STORE=1]="STORE"})(Fe||(Fe={}));var j=Fe,Dr={parseFilePath:Ze,renderFilePath:Xe,parse:function(e){let t=e.args,i=new m(t,this.liquid.options.operatorsTrie);for(this.file=this.parseFilePath(i,this.liquid),this.currentFile=e.file;!i.end();){i.skipBlank();let r=i.p,s=i.readIdentifier();if((s.content==="with"||s.content==="for")&&(i.skipBlank(),i.peek()!==":")){let n=i.readValue();if(n){let o=i.p,l=i.readIdentifier(),a;l.content==="as"?a=i.readIdentifier():i.p=o,this[s.content]={value:n,alias:a&&a.content},i.skipBlank(),i.peek()===","&&i.advance();continue}}i.p=r;break}this.hash=new I(i.remaining())},render:function*(e,t){let{liquid:i,hash:r}=this,s=yield this.renderFilePath(this.file,e,i);g(s,()=>`illegal filename "${s}"`);let n=new $({},e.opts,{sync:e.sync,globals:e.globals,strictVariables:e.strictVariables}),o=n.bottom();if(X(o,yield r.render(e)),this.with){let{value:l,alias:a}=this.with;o[a||s]=yield w(l,e)}if(this.for){let{value:l,alias:a}=this.for,u=yield w(l,e);u=Qe(u),o.forloop=new J(u.length,l.getText(),a);for(let p of u){o[a]=p;let y=yield i._parsePartialFile(s,n.sync,this.currentFile);yield i.renderer.renderTemplates(y,n,t),o.forloop.next()}}else{let l=yield i._parsePartialFile(s,n.sync,this.currentFile);yield i.renderer.renderTemplates(l,n,t)}}};function Ze(e,t){if(t.options.dynamicPartials){let s=e.readValue();if(s===void 0)throw new TypeError(`illegal argument "${e.input}"`);if(s.getText()==="none")return null;if(Rt(s)){let n=t.parse(Ge(s));return dt(n)}return s}let i=[...e.readFileNameTemplate(t.options)],r=dt(t.parser.parseTokens(i));return r==="none"?null:r}function dt(e){return e.length===1&&Ye(e[0].token)?e[0].token.getContent():e}function*Xe(e,t,i){return typeof e=="string"?e:Array.isArray(e)?i.renderer.renderTemplates(e,t):yield w(e,t)}var Wr={parseFilePath:Ze,renderFilePath:Xe,parse:function(e){let t=e.args,i=new m(t,this.liquid.options.operatorsTrie);this.file=this.parseFilePath(i,this.liquid),this.currentFile=e.file;let r=i.p;i.readIdentifier().content==="with"?(i.skipBlank(),i.peek()!==":"?this.withVar=i.readValue():i.p=r):i.p=r,this.hash=new I(i.remaining(),this.liquid.options.jekyllInclude)},render:function*(e,t){let{liquid:i,hash:r,withVar:s}=this,{renderer:n}=i,o=yield this.renderFilePath(this.file,e,i);g(o,()=>`illegal filename "${o}"`);let l=e.saveRegister("blocks","blockMode");e.setRegister("blocks",{}),e.setRegister("blockMode",j.OUTPUT);let a=yield r.render(e);s&&(a[o]=yield w(s,e));let u=yield i._parsePartialFile(o,e.sync,this.currentFile);e.push(e.opts.jekyllInclude?{include:a}:a),yield n.renderTemplates(u,e,t),e.pop(),e.restoreRegister(l)}},Vr={parse:function(e){let t=new m(e.args,this.liquid.options.operatorsTrie);this.variable=t.readIdentifier().content},render:function(e,t){let i=e.environments;De(i[this.variable])||(i[this.variable]=0),t.write(c(--i[this.variable]))}},Br={parse:function(e){let t=new m(e.args,this.liquid.options.operatorsTrie),i=t.readValue();for(t.skipBlank(),this.candidates=[],i&&(t.peek()===":"?(this.group=i,t.advance()):this.candidates.push(i));!t.end();){let r=t.readValue();r&&this.candidates.push(r),t.readTo(",")}g(this.candidates.length,()=>`empty candidates: ${e.getText()}`)},render:function*(e,t){let r=`cycle:${yield w(this.group,e)}:`+this.candidates.join(","),s=e.getRegister("cycle"),n=s[r];n===void 0&&(n=s[r]=0);let o=this.candidates[n];n=(n+1)%this.candidates.length,s[r]=n;let l=yield w(o,e);t.write(l)}},jr={parse:function(e,t){this.branches=[],this.elseTemplates=[];let i;this.liquid.parser.parseStream(t).on("start",()=>this.branches.push({predicate:new S(e.args,this.liquid),templates:i=[]})).on("tag:elsif",r=>this.branches.push({predicate:new S(r.args,this.liquid),templates:i=[]})).on("tag:else",()=>i=this.elseTemplates).on("tag:endif",function(){this.stop()}).on("template",r=>i.push(r)).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)}).start()},render:function*(e,t){let i=this.liquid.renderer;for(let{predicate:r,templates:s}of this.branches){let n=yield r.value(e,e.opts.lenientIf);if(N(n,e)){yield i.renderTemplates(s,e,t);return}}yield i.renderTemplates(this.elseTemplates,e,t)}},Hr={parse:function(e){let t=new m(e.args,this.liquid.options.operatorsTrie);this.variable=t.readIdentifier().content},render:function(e,t){let i=e.environments;De(i[this.variable])||(i[this.variable]=0);let r=i[this.variable];i[this.variable]++,t.write(c(r))}},Qr={parseFilePath:Ze,renderFilePath:Xe,parse:function(e,t){let i=new m(e.args,this.liquid.options.operatorsTrie);this.file=this.parseFilePath(i,this.liquid),this.currentFile=e.file,this.hash=new I(i.remaining()),this.tpls=this.liquid.parser.parseTokens(t)},render:function*(e,t){let{liquid:i,hash:r,file:s}=this,{renderer:n}=i;if(s===null){e.setRegister("blockMode",j.OUTPUT),yield n.renderTemplates(this.tpls,e,t);return}let o=yield this.renderFilePath(this.file,e,i);g(o,()=>`illegal filename "${o}"`);let l=yield i._parseLayoutFile(o,e.sync,this.currentFile);e.setRegister("blockMode",j.STORE);let a=yield n.renderTemplates(this.tpls,e),u=e.getRegister("blocks");u[""]===void 0&&(u[""]=(p,y)=>y.write(a)),e.setRegister("blockMode",j.OUTPUT),e.push(yield r.render(e)),yield n.renderTemplates(l,e,t),e.pop()}},oe=class extends x{constructor(t=()=>""){super(),this.superBlockRender=t}super(){return this.superBlockRender()}},Yr={parse(e,t){let i=/\w+/.exec(e.args);this.block=i?i[0]:"",this.tpls=[],this.liquid.parser.parseStream(t).on("tag:endblock",function(){this.stop()}).on("template",r=>this.tpls.push(r)).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)}).start()},*render(e,t){let i=this.getBlockRender(e);e.getRegister("blockMode")===j.STORE?e.getRegister("blocks")[this.block]=i:yield i(new oe,t)},getBlockRender(e){let{liquid:t,tpls:i}=this,r=e.getRegister("blocks")[this.block],s=function*(n,o){e.push({block:n}),yield t.renderer.renderTemplates(i,e,o),e.pop()};return r?(n,o)=>r(new oe(()=>s(n,o)),o):s}},Jr={parse:function(e,t){this.tokens=[];let i=this.liquid.parser.parseStream(t);i.on("token",r=>{r.name==="endraw"?i.stop():this.tokens.push(r)}).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)}),i.start()},render:function(){return this.tokens.map(e=>e.getText()).join("")}},Re=class extends J{constructor(t,i,r,s){super(t,r,s),this.length=t,this.cols=i}row(){return Math.floor(this.i/this.cols)+1}col0(){return this.i%this.cols}col(){return this.col0()+1}col_first(){return this.col0()===0}col_last(){return this.col()===this.cols}},Gr={parse:function(e,t){let i=new m(e.args,this.liquid.options.operatorsTrie),r=i.readIdentifier();i.skipBlank();let s=i.readIdentifier();g(s&&s.content==="in",()=>`illegal tag: ${e.getText()}`),this.variable=r.content,this.collection=i.readValue(),this.hash=new I(i.remaining()),this.templates=[];let n,o=this.liquid.parser.parseStream(t).on("start",()=>n=this.templates).on("tag:endtablerow",()=>o.stop()).on("template",l=>n.push(l)).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)});o.start()},render:function*(e,t){let i=Qe(yield w(this.collection,e)),r=yield this.hash.render(e),s=r.offset||0,n=r.limit===void 0?i.length:r.limit;i=i.slice(s,s+n);let o=r.cols||i.length,l=this.liquid.renderer,a=new Re(i.length,o,this.collection.getText(),this.variable),u={tablerowloop:a};e.push(u);for(let p=0;p<i.length;p++,a.next())u[this.variable]=i[p],a.col0()===0&&(a.row()!==1&&t.write("</tr>"),t.write(`<tr class="row${a.row()}">`)),t.write(`<td class="col${a.col()}">`),yield l.renderTemplates(this.templates,e,t),t.write("</td>");i.length&&t.write("</tr>"),e.pop()}},Zr={parse:function(e,t){this.branches=[],this.elseTemplates=[];let i;this.liquid.parser.parseStream(t).on("start",()=>this.branches.push({predicate:new S(e.args,this.liquid),test:je,templates:i=[]})).on("tag:elsif",r=>this.branches.push({predicate:new S(r.args,this.liquid),test:N,templates:i=[]})).on("tag:else",()=>i=this.elseTemplates).on("tag:endunless",function(){this.stop()}).on("template",r=>i.push(r)).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)}).start()},render:function*(e,t){let i=this.liquid.renderer;for(let{predicate:r,test:s,templates:n}of this.branches){let o=yield r.value(e,e.opts.lenientIf);if(s(o,e)){yield i.renderTemplates(n,e,t);return}}yield i.renderTemplates(this.elseTemplates,e,t)}},Xr={render:function(e,t){t.break=!0}},Kr={render:function(e,t){t.continue=!0}},es={parse:function(e){this.value=new S(e.args,this.liquid)},render:function*(e,t){let i=yield this.value.value(e,!1);t.write(i)}},ts={parse:function(e){let i=new m(e.args,this.liquid.options.operatorsTrie).readLiquidTagTokens(this.liquid.options);this.tpls=this.liquid.parser.parseTokens(i)},render:function*(e,t){yield this.liquid.renderer.renderTemplates(this.tpls,e,t)}},is={parse:function(e,t){if(e.args.search(/\n\s*[^#\s]/g)!==-1)throw new Error("every line of an inline comment must start with a '#' character")}},rs={assign:Er,for:Pr,capture:$r,case:Ur,comment:zr,include:Wr,render:Dr,decrement:Vr,increment:Hr,cycle:Br,if:jr,layout:Qr,block:Yr,raw:Jr,tablerow:Gr,unless:Zr,break:Xr,continue:Kr,echo:es,liquid:ts,"#":is};var Et=new Map;le(Ot,(e,t)=>{Et.set(ue(t),e)});var P={root:["."],layouts:["."],partials:["."],relativeReference:!0,jekyllInclude:!1,cache:void 0,extname:"",fs:Jt,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:rt,operatorsTrie:_t(rt)};function ss(e){if(e.hasOwnProperty("operators")&&(e.operatorsTrie=_t(e.operators)),e.hasOwnProperty("root")&&(e.hasOwnProperty("partials")||(e.partials=e.root),e.hasOwnProperty("layouts")||(e.layouts=e.root)),e.hasOwnProperty("cache")){let t;typeof e.cache=="number"?t=e.cache>0?new te(e.cache):void 0:typeof e.cache=="object"?t=e.cache:t=e.cache?new te(1024):void 0,e.cache=t}return e=Object.assign(Object.assign(Object.assign({},P),e.jekyllInclude?{dynamicPartials:!1}:{}),e),!e.fs.dirname&&e.relativeReference&&(console.warn("[LiquidJS] `fs.dirname` is required for relativeReference, set relativeReference to `false` to suppress this warning, or provide implementation for `fs.dirname`"),e.relativeReference=!1),e.root=Z(e.root),e.partials=Z(e.partials),e.layouts=Z(e.layouts),e.outputEscape=e.outputEscape&&ns(e.outputEscape),e}function ns(e){if(L(e)){let t=Et.get(e);return g(q(t),`filter "${e}" not found`),t}else return g(q(e),"`outputEscape` need to be of type string or function"),e}function Z(e){let t=[];return T(e)&&(t=e),L(e)&&(t=[e]),t}var $=class{constructor(t={},i=P,r={}){var s,n;this.scopes=[{}],this.registers={},this.sync=!!r.sync,this.opts=i,this.globals=(s=r.globals)!==null&&s!==void 0?s:i.globals,this.environments=t,this.strictVariables=(n=r.strictVariables)!==null&&n!==void 0?n:this.opts.strictVariables}getRegister(t){return this.registers[t]=this.registers[t]||{}}setRegister(t,i){return this.registers[t]=i}saveRegister(...t){return t.map(i=>[i,this.getRegister(i)])}restoreRegister(t){return t.forEach(([i,r])=>this.setRegister(i,r))}getAll(){return[this.globals,this.environments,...this.scopes].reduce((t,i)=>X(t,i),{})}get(t){return A(this._get(t))}*_get(t){let i=this.findScope(t[0]);return yield this._getFromScope(i,t)}getFromScope(t,i){return A(this._getFromScope(t,i))}*_getFromScope(t,i){L(i)&&(i=i.split("."));for(let r=0;r<i.length;r++)if(t=yield os(t,i[r],this.opts.ownPropertyOnly),E(t)&&this.strictVariables)throw new de(i.slice(0,r+1).join("."));return t}push(t){return this.scopes.push(t)}pop(){return this.scopes.pop()}bottom(){return this.scopes[0]}findScope(t){for(let i=this.scopes.length-1;i>=0;i--){let r=this.scopes[i];if(t in r)return r}return t in this.environments?this.environments:this.globals}};function os(e,t,i){if(E(e))return e;if(e=gt(e),T(e)&&t<0)return e[e.length+ +t];let r=as(e,t,i);return r===void 0&&e instanceof x?e.liquidMethodMissing(t):q(r)?r.call(e):t==="size"?cs(e):t==="first"?ls(e):t==="last"?us(e):r}function as(e,t,i){if(!(i&&!Object.hasOwnProperty.call(e,t)))return e[t]}function ls(e){return T(e)?e[0]:e.first}function us(e){return T(e)?e[e.length-1]:e.last}function cs(e){if(e.hasOwnProperty("size")||e.size!==void 0)return e.size;if(T(e)||L(e))return e.length;if(typeof e=="object")return Object.keys(e).length}var C;(function(e){e.Partials="partials",e.Layouts="layouts",e.Root="root"})(C||(C={}));var xe=class{constructor(t){if(this.options=t,t.relativeReference){let i=t.fs.sep;g(i,"`fs.sep` is required for relative reference");let r=new RegExp(["."+i,".."+i,"./","../"].map(s=>$t(s)).join("|"));this.shouldLoadRelative=s=>r.test(s)}else this.shouldLoadRelative=i=>!1;this.contains=this.options.fs.contains||(()=>!0)}*lookup(t,i,r,s){let{fs:n}=this.options,o=this.options[i];for(let l of this.candidates(t,o,s,i!==C.Root))if(r?n.existsSync(l):yield n.exists(l))return l;throw this.lookupError(t,o)}*candidates(t,i,r,s){let{fs:n,extname:o}=this.options;if(this.shouldLoadRelative(t)&&r){let l=n.resolve(this.dirname(r),t,o);for(let a of i)if(!s||this.contains(a,l)){yield l;break}}for(let l of i){let a=n.resolve(l,t,o);(!s||this.contains(l,a))&&(yield a)}if(n.fallback!==void 0){let l=n.fallback(t);l!==void 0&&(yield l)}}dirname(t){let i=this.options.fs;return g(i.dirname,"`fs.dirname` is required for relative reference"),i.dirname(t)}lookupError(t,i){let r=new Error("ENOENT");return r.message=`ENOENT: Failed to lookup "${t}" in "${i}"`,r.code="ENOENT",r}},Ie=class{constructor(){this.buffer=""}write(t){this.buffer+=c(t)}},Ee=class{constructor(){throw this.buffer="",this.stream=null,new Error("streaming not supported in browser")}},Pe=class{constructor(){this.buffer=""}write(t){t=h(t),typeof t!="string"&&this.buffer===""?this.buffer=t:this.buffer=c(this.buffer)+c(t)}},Ne=class{renderTemplatesToNodeStream(t,i){let r=new Ee;return Promise.resolve().then(()=>M(this.renderTemplates(t,i,r))).then(()=>r.end(),s=>r.error(s)),r.stream}*renderTemplates(t,i,r){r||(r=i.opts.keepOutputType?new Pe:new Ie);for(let s of t)try{let n=yield s.render(i,r);if(n&&r.write(n),r.break||r.continue)break}catch(n){throw ie.is(n)?n:new ie(n,s)}return r.buffer}},G=class{constructor(t){this.token=t}},Me=class extends G{constructor(t,i,r){super(t),this.name=t.name;let s=r.tags.get(t.name);this.impl=Object.create(s),this.impl.liquid=r,this.impl.parse&&this.impl.parse(t,i)}*render(t,i){let r=yield new I(this.token.args).render(t),s=this.impl;if(q(s.render))return yield s.render(t,i,r)}},Ae=class extends G{constructor(t,i){super(t),this.value=new S(t.content,i);let r=this.value.filters,s=i.options.outputEscape;r.length&&r[r.length-1].name==="raw"?r.pop():s&&r.push(new Y(toString.call(s),s,[],i))}*render(t,i){let r=yield this.value.value(t,!1);i.write(r)}},$e=class extends G{constructor(t){super(t),this.str=t.getContent()}*render(t,i){i.write(this.str)}},Ce=class{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 xe(this.liquid.options)}parse(t,i){let s=new m(t,this.liquid.options.operatorsTrie,i).readTopLevelTokens(this.liquid.options);return this.parseTokens(s)}parseTokens(t){let i,r=[];for(;i=t.shift();)r.push(this.parseToken(i,t));return r}parseToken(t,i){try{return Je(t)?new Me(t,i,this.liquid):fr(t)?new Ae(t,this.liquid):new $e(t)}catch(r){throw new he(r,t)}}parseStream(t){return new Oe(t,(i,r)=>this.parseToken(i,r))}*_parseFileCached(t,i,r=C.Root,s){let n=this.cache,o=this.loader.shouldLoadRelative(t)?s+","+t:r+":"+t,l=yield n.read(o);if(l)return l;let a=this._parseFile(t,i,r,s),u=i?yield a:M(a);n.write(o,u);try{return yield u}catch(p){throw n.remove(o),p}}*_parseFile(t,i,r=C.Root,s){let n=yield this.loader.lookup(t,r,i,s);return this.liquid.parse(i?this.fs.readFileSync(n):yield this.fs.readFile(n),n)}},Ue=class{constructor(){this.impls={}}get(t){let i=this.impls[t];return g(i,()=>`tag "${t}" not found`),i}set(t,i){this.impls[t]=i}},ze=class{constructor(t,i){this.strictFilters=t,this.liquid=i,this.impls={}}get(t){let i=this.impls[t];return g(i||!this.strictFilters,()=>`undefined filter: ${t}`),i}set(t,i){this.impls[t]=i}create(t,i){return new Y(t,this.get(t),i,this.liquid)}};var W=class{constructor(t={}){this.options=ss(t),this.parser=new Ce(this),this.renderer=new Ne,this.filters=new ze(this.options.strictFilters,this),this.tags=new Ue,le(rs,(i,r)=>this.registerTag(ue(r),i)),le(Ot,(i,r)=>this.registerFilter(ue(r),i))}parse(t,i){return this.parser.parse(t,i)}_render(t,i,r){let s=new $(i,this.options,r);return this.renderer.renderTemplates(t,s)}render(t,i,r){return O(this,void 0,void 0,function*(){return M(this._render(t,i,Object.assign(Object.assign({},r),{sync:!1})))})}renderSync(t,i,r){return A(this._render(t,i,Object.assign(Object.assign({},r),{sync:!0})))}renderToNodeStream(t,i,r={}){let s=new $(i,this.options,r);return this.renderer.renderTemplatesToNodeStream(t,s)}_parseAndRender(t,i,r){let s=this.parse(t);return this._render(s,i,r)}parseAndRender(t,i,r){return O(this,void 0,void 0,function*(){return M(this._parseAndRender(t,i,Object.assign(Object.assign({},r),{sync:!1})))})}parseAndRenderSync(t,i,r){return A(this._parseAndRender(t,i,Object.assign(Object.assign({},r),{sync:!0})))}_parsePartialFile(t,i,r){return this.parser.parseFile(t,i,C.Partials,r)}_parseLayoutFile(t,i,r){return this.parser.parseFile(t,i,C.Layouts,r)}parseFile(t){return O(this,void 0,void 0,function*(){return M(this.parser.parseFile(t,!1))})}parseFileSync(t){return A(this.parser.parseFile(t,!0))}renderFile(t,i,r){return O(this,void 0,void 0,function*(){let s=yield this.parseFile(t);return this.render(s,i,r)})}renderFileSync(t,i,r){let s=this.parseFileSync(t);return this.renderSync(s,i,r)}renderFileToNodeStream(t,i,r){return O(this,void 0,void 0,function*(){let s=yield this.parseFile(t);return this.renderToNodeStream(s,i,r)})}_evalValue(t,i){let r=new S(t,this),s=i instanceof $?i:new $(i,this.options);return r.value(s,!1)}evalValue(t,i){return O(this,void 0,void 0,function*(){return M(this._evalValue(t,i))})}evalValueSync(t,i){return A(this._evalValue(t,i))}registerFilter(t,i){this.filters.set(t,i)}registerTag(t,i){this.tags.set(t,i)}plugin(t){return t.call(this,W)}express(){let t=this,i=!0;return function(r,s,n){if(i){i=!1;let o=Z(this.root);t.options.root.unshift(...o),t.options.layouts.unshift(...o),t.options.partials.unshift(...o)}t.renderFile(r,s).then(o=>n(null,o),n)}}};import{html as hs,unsafeStatic as ps}from"https://cdn.jsdelivr.net/npm/lit-html@2.4.0/static/+esm";var Ke=e=>function(){let t=(a,u)=>e.utils.url.getVariantUrl(a.url,u==null?void 0:u.id),i=(a,...u)=>e.utils.url.getImageUrl(a,Pt(u)),r=(a="")=>e.utils.url.getFileUrl(a),s=(a="",u)=>e.utils.url.getImageUrl({src:e.utils.url.getFileUrl(a.replace(".",`_${u}.`))}),n=a=>e.utils.money.formatMoney(a),o=(a,...u)=>{try{return u.length?this.parseAndRenderSync(e.theme.translate(a),Pt(u)):e.theme.translate(a)}catch(p){return a}},l=(a="")=>a.toLowerCase().trim().replace(/[^a-zA-Z0-9]/g,"-").replace(/[-]{2,}/g,"-");this.registerFilter("variant_url",t),this.registerFilter("image_url",i),this.registerFilter("file_url",r),this.registerFilter("file_img_url",s),this.registerFilter("money",n),this.registerFilter("t",o),this.registerFilter("handle",l),this.registerFilter("handleize",l)},Pt=e=>e.reduce((t,[i,r])=>r?{...t,[i]:r}:t,{});import{WishlistElement as ds}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.5/wishlist-element.js";var et=class extends ds{constructor(){super();this.initLiquid()}static get properties(){return{}}async initLiquid(){await this.app.load(),this.dataUtil=new V,this.globals={settings:{login_required:this.app.settings.general.wishlistAccessMode!=="UNRESTRICTED"},customer:this.app.customer,shop:{currency:this.app.config.shop.currency,customer_accounts_enabled:this.app.config.shop.customerAccountsEnabled,domain:this.app.config.shop.domain,money_format:this.app.config.shop.moneyFormat,name:this.app.config.shop.name,permanent_domain:this.app.config.shop.permanentDomain},routes:{root_url:this.app.routes.rootUrl,wishlist_url:this.app.routes.wishlistUrl,account_url:this.app.routes.accountUrl,account_login_url:this.app.routes.accountLoginUrl,account_logout_url:this.app.routes.accountLogoutUrl,account_register_url:this.app.routes.accountRegisterUrl,account_addresses_url:this.app.routes.accountAddressesUrl,collections_url:this.app.routes.collectionsUrl,all_products_collection_url:this.app.routes.allProductsCollectionUrl,search_url:this.app.routes.searchUrl,predictive_search_url:this.app.routes.predictiveSearchUrl,cart_url:this.app.routes.cartUrl,cart_add_url:this.app.routes.cartAddUrl,cart_change_url:this.app.routes.cartChangeUrl,cart_clear_url:this.app.routes.cartClearUrl,cart_update_url:this.app.routes.cartUpdateUrl,product_recommendations_url:this.app.routes.productRecommendationsUrl}},this.liquidEngine=new W({cache:!0,relativeReference:!1}),this.liquidEngine.plugin(Ke(this.app)),this.parsedTemplates=this.liquidEngine.parse(this.getLiquidTemplate()),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),this.parsedTemplates=void 0}getLiquidTemplate(){return""}getLiquidData(){return{}}render(){var l;if(!this.parsedTemplates||!this.liquidEngine||!this.dataUtil)return;let{wishlist:i,wishlistItem:r,productInfo:s}=(l=this.state)!=null?l:{},n={...this.dataUtil.objectToSnakeCase(this.getLiquidData()),wishlist:i?this.dataUtil.mapWishlistState(i):void 0,wishlist_item:r?this.dataUtil.mapWishlistItem(r):void 0,product_info:s?this.dataUtil.mapProductInfo(s):void 0},o=this.liquidEngine.renderSync(this.parsedTemplates,n,{globals:this.globals});return hs`${ps(o)}`}};export{V as LiquidDataUtil,et as LiquidElement,Ke as liquidShopifyFilters};
{
"name": "@appmate/wishlist",
"version": "4.17.4",
"version": "4.17.5",
"description": "Wishlist King SDK",

@@ -5,0 +5,0 @@ "main": "index.js",

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

var o=class{constructor(t){this.element=t}replace(t){var e;return(e=this.element)==null||e.replaceWith(t),t}append(t){var e;return(e=this.element)==null||e.append(t),t}prepend(t){var e;return(e=this.element)==null||e.prepend(t),t}insertBefore(t){var e;return(e=this.element)==null||e.before(t),t}insertAfter(t){var e;return(e=this.element)==null||e.after(t),t}closest(t,e=5){if(!this.element)return new o;if(typeof t=="object")return this.searchByStyle(t,this.element,a=>a.parentElement,e);let r=this.element.closest(t);return r?new o(r):new o}find(t){var r;let e=(r=this.element)==null?void 0:r.querySelector(t);return e?new o(e):new o}searchByStyle(t,e,r,a=5){if(a<0||!e)return null;let n=getComputedStyle(e);if(Object.entries(t).every(([h,d])=>n.getPropertyValue(h)===d))return new o(e);let c=r(e);return c?this.searchByStyle(t,c,r,a-1):null}};var l=class{constructor({routeUtil:t}){this.subscriber=[],this.routeUtil=t,this.observer=new MutationObserver(e=>{e.reduce((r,a)=>r.concat(Array.from(a.addedNodes)),[]).filter(r=>r instanceof Element&&!r.hasAttribute("data-appmate")).forEach(r=>this.scan(r))}),this.observer.observe(document.body,{subtree:!0,childList:!0,attributes:!1})}watch(t,e){let r={target:t,callback:e};this.subscriber.push(r),m(r,this.routeUtil.parse(window.location.pathname))&&this.scan(document.body)}shouldSkip(t,{skipHidden:e}){return e&&t instanceof HTMLElement?t.offsetParent===null:!1}scan(t){this.subscriber.filter(e=>m(e,this.routeUtil.parse(window.location.pathname))).forEach(e=>{let r=t.matches(e.target.selector)&&!this.shouldSkip(t,{skipHidden:!!e.target.skipHidden});if(r&&this.notify(e,t),r&&e.target.firstMatch)return;let a=t.querySelectorAll(e.target.selector);for(let n of a)if(!this.shouldSkip(n,{skipHidden:!!e.target.skipHidden})&&(this.notify(e,n),e.target.firstMatch))break})}notify(t,e){if(!e.hasAttribute("data-appmate")){e.setAttribute("data-appmate","");let r=new o(e);t.callback(r)}}};function m({target:s},t){if(!s.pageType)return!0;if(!t.pageType)return!1;let e=Array.isArray(s.pageType)?s.pageType:[s.pageType];return e.includes("all")?!0:e.includes(t.pageType)}var y=[{pageType:"product",match:s=>s.includes("/products/")},{pageType:"collection",match:s=>s.includes("/collections/")&&!s.includes("/products/")},{pageType:"account",match:s=>s.includes("/account/")||s.endsWith("/account")},{pageType:"blog",match:s=>s.includes("/blog/")},{pageType:"cart",match:s=>s.includes("/cart/")||s.endsWith("/cart")},{pageType:"wishlist",match:(s,{wishlistUrl:t})=>s.includes(t)},{pageType:"page",match:s=>s.includes("/pages/")},{pageType:"home",match:s=>s.length<4}],p=class{constructor({wishlistUrl:t}){this.wishlistUrl=t}parse(t){for(let e of y)if(e.match(t,{wishlistUrl:this.wishlistUrl}))return{pageType:e.pageType};return{pageType:void 0}}};var u=class{constructor(t){var e;this.locale=this.decodeLocale((e=t.locale)!=null?e:{})}decodeHtmlEntities(t){return t.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&#39;/g,"'")}decodeLocale(t){let e={};for(let r in t){e[r]={};for(let a in t[r])e[r][a]=this.decodeHtmlEntities(t[r][a])}return e}translate(t,e){var i;let[r,a]=t.split("."),n=(i=this.locale[r])==null?void 0:i[a];return n?e?Object.entries(e).reduce((c,[h,d])=>c.replace(new RegExp(`{{\\s*${h}\\s*}}`,"g"),d),n):n:`translation missing: ${t}`}};var g=class{constructor({rootUrl:t,wishlistUrl:e,locale:r}){this._rootUrl=t,this.route=new p({wishlistUrl:e}),this.observer=new l({routeUtil:this.route}),this.locale=new u({locale:r}),this.watch=this.observer.watch.bind(this.observer)}getPageType(t=window.location.pathname){return this.route.parse(t).pageType}getWishlistId(t){if(!t)return null;t instanceof URL&&(t=t.pathname);let e=t.replace(this._rootUrl,"/").split("/");return e.length===4?e.pop():"mine"}getProductHandle(t){var e;return t?(t instanceof URL&&(t=t.pathname),(e=t.split("/").pop())==null?void 0:e.split("?")[0]):null}getVariantId(t){return t?(t instanceof URL&&(t=t.pathname),new URLSearchParams(t.split("?")[1]).get("variant")):null}translate(t,e){return this.locale.translate(t,e)}createComponent(t,e){var a;let r=document.createElement(t);return e!=null&&e.dataset&&Object.entries(e==null?void 0:e.dataset).forEach(([n,i])=>{!i||(typeof i=="boolean"?r.dataset[n]="":typeof i=="object"?r.dataset[n]=JSON.stringify(i):r.dataset[n]=i)}),e!=null&&e.props&&Object.entries(e==null?void 0:e.props).forEach(([n,i])=>{r[n]=i}),(a=e==null?void 0:e.wrap)!=null&&a.name&&this.createElement(e.wrap.name,e.wrap.props,r),r}createElement(t,e={},...r){let a=Object.assign(document.createElement(t),e);return r&&a.append(...r),a}};export{g as ThemeHelper};
var o=class{constructor(t){this.element=t}replace(t){var e;return(e=this.element)==null||e.replaceWith(t),t}append(t){var e;return(e=this.element)==null||e.append(t),t}prepend(t){var e;return(e=this.element)==null||e.prepend(t),t}insertBefore(t){var e;return(e=this.element)==null||e.before(t),t}insertAfter(t){var e;return(e=this.element)==null||e.after(t),t}closest(t,e=5){if(!this.element)return new o;if(typeof t=="object")return this.searchByStyle(t,this.element,a=>a.parentElement,e);let r=this.element.closest(t);return r?new o(r):new o}find(t){var r;let e=(r=this.element)==null?void 0:r.querySelector(t);return e?new o(e):new o}searchByStyle(t,e,r,a=5){if(a<0||!e)return null;let n=getComputedStyle(e);if(Object.entries(t).every(([h,d])=>n.getPropertyValue(h)===d))return new o(e);let c=r(e);return c?this.searchByStyle(t,c,r,a-1):null}};var l=class{constructor({routeUtil:t}){this.subscriber=[],this.routeUtil=t,this.observer=new MutationObserver(e=>{e.reduce((r,a)=>r.concat(Array.from(a.addedNodes)),[]).filter(r=>r instanceof Element&&!r.hasAttribute("data-appmate")).forEach(r=>this.scan(r))}),this.observer.observe(document.body,{subtree:!0,childList:!0,attributes:!1})}watch(t,e){let r={target:t,callback:e};this.subscriber.push(r),m(r,this.routeUtil.parse(window.location.pathname))&&this.scan(document.body)}shouldSkip(t,{skipHidden:e}){return e&&t instanceof HTMLElement?t.offsetParent===null:!1}scan(t){this.subscriber.filter(e=>m(e,this.routeUtil.parse(window.location.pathname))).forEach(e=>{let r=t.matches(e.target.selector)&&!this.shouldSkip(t,{skipHidden:!!e.target.skipHidden});if(r&&this.notify(e,t),r&&e.target.firstMatch)return;let a=t.querySelectorAll(e.target.selector);for(let n of a)if(!this.shouldSkip(n,{skipHidden:!!e.target.skipHidden})&&(this.notify(e,n),e.target.firstMatch))break})}notify(t,e){if(!e.hasAttribute("data-appmate")){e.setAttribute("data-appmate","");let r=new o(e);t.callback(r)}}};function m({target:s},t){if(!s.pageType)return!0;if(!t.pageType)return!1;let e=Array.isArray(s.pageType)?s.pageType:[s.pageType];return e.includes("all")?!0:e.includes(t.pageType)}var y=[{pageType:"product",match:s=>s.includes("/products/")},{pageType:"collection",match:s=>s.includes("/collections/")&&!s.includes("/products/")},{pageType:"account",match:s=>s.includes("/account/")||s.endsWith("/account")},{pageType:"blog",match:s=>s.includes("/blog/")},{pageType:"cart",match:s=>s.includes("/cart/")||s.endsWith("/cart")},{pageType:"wishlist",match:(s,{wishlistUrl:t})=>s.includes(t)},{pageType:"page",match:s=>s.includes("/pages/")},{pageType:"home",match:s=>s.length<4}],p=class{constructor({wishlistUrl:t}){this.wishlistUrl=t}parse(t){for(let e of y)if(e.match(t,{wishlistUrl:this.wishlistUrl}))return{pageType:e.pageType};return{pageType:void 0}}};var u=class{constructor(t){var e;this.locale=this.decodeLocale((e=t.locale)!=null?e:{})}decodeHtmlEntities(t){return t.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&#39;/g,"'")}decodeLocale(t){let e={};for(let r in t){e[r]={};for(let a in t[r])e[r][a]=this.decodeHtmlEntities(t[r][a])}return e}translate(t,e){var i;let[r,a]=t.split("."),n=(i=this.locale[r])==null?void 0:i[a];return n?e?Object.entries(e).reduce((c,[h,d])=>c.replace(new RegExp(`{{\\s*${h}\\s*}}`,"g"),d),n):n:`translation missing: ${t}`}};var g=class{constructor({rootUrl:t,wishlistUrl:e,locale:r}){this._rootUrl=t,this.route=new p({wishlistUrl:e}),this.observer=new l({routeUtil:this.route}),this.locale=new u({locale:r}),this.watch=this.observer.watch.bind(this.observer)}getPageType(t=window.location.pathname){return this.route.parse(t).pageType}getWishlistId(t){if(!t)return null;t instanceof URL&&(t=t.pathname);let e=t.replace(this._rootUrl,"/").split("/");return e.length===4?e.pop():"mine"}getProductHandle(t){var e;return t?(t instanceof URL&&(t=t.pathname),(e=t.split("/").pop())==null?void 0:e.split("?")[0]):null}getVariantId(t){return t?(t instanceof URL&&(t=t.pathname),new URLSearchParams(t.split("?")[1]).get("variant")):null}translate(t,e){return this.locale.translate(t,e)}createComponent(t,e){var a;let r=document.createElement(t);return e!=null&&e.dataset&&Object.entries(e==null?void 0:e.dataset).forEach(([n,i])=>{!i||(typeof i=="boolean"?r.dataset[n]="":typeof i=="object"?r.dataset[n]=JSON.stringify(i):r.dataset[n]=i)}),e!=null&&e.props&&Object.entries(e==null?void 0:e.props).forEach(([n,i])=>{r[n]=i}),(a=e==null?void 0:e.wrap)!=null&&a.name?this.createElement(e.wrap.name,e.wrap.props,r):r}createElement(t,e={},...r){let a=Object.assign(document.createElement(t),e);return r&&a.append(...r),a}};export{g as ThemeHelper};

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

var p=class{constructor(t){this.element=t}replace(t){var e;return(e=this.element)==null||e.replaceWith(t),t}append(t){var e;return(e=this.element)==null||e.append(t),t}prepend(t){var e;return(e=this.element)==null||e.prepend(t),t}insertBefore(t){var e;return(e=this.element)==null||e.before(t),t}insertAfter(t){var e;return(e=this.element)==null||e.after(t),t}closest(t,e=5){if(!this.element)return new p;if(typeof t=="object")return this.searchByStyle(t,this.element,i=>i.parentElement,e);let s=this.element.closest(t);return s?new p(s):new p}find(t){var s;let e=(s=this.element)==null?void 0:s.querySelector(t);return e?new p(e):new p}searchByStyle(t,e,s,i=5){if(i<0||!e)return null;let r=getComputedStyle(e);if(Object.entries(t).every(([l,c])=>r.getPropertyValue(l)===c))return new p(e);let n=s(e);return n?this.searchByStyle(t,n,s,i-1):null}};var u=class{constructor({routeUtil:t}){this.subscriber=[],this.routeUtil=t,this.observer=new MutationObserver(e=>{e.reduce((s,i)=>s.concat(Array.from(i.addedNodes)),[]).filter(s=>s instanceof Element&&!s.hasAttribute("data-appmate")).forEach(s=>this.scan(s))}),this.observer.observe(document.body,{subtree:!0,childList:!0,attributes:!1})}watch(t,e){let s={target:t,callback:e};this.subscriber.push(s),K(s,this.routeUtil.parse(window.location.pathname))&&this.scan(document.body)}shouldSkip(t,{skipHidden:e}){return e&&t instanceof HTMLElement?t.offsetParent===null:!1}scan(t){this.subscriber.filter(e=>K(e,this.routeUtil.parse(window.location.pathname))).forEach(e=>{let s=t.matches(e.target.selector)&&!this.shouldSkip(t,{skipHidden:!!e.target.skipHidden});if(s&&this.notify(e,t),s&&e.target.firstMatch)return;let i=t.querySelectorAll(e.target.selector);for(let r of i)if(!this.shouldSkip(r,{skipHidden:!!e.target.skipHidden})&&(this.notify(e,r),e.target.firstMatch))break})}notify(t,e){if(!e.hasAttribute("data-appmate")){e.setAttribute("data-appmate","");let s=new p(e);t.callback(s)}}};function K({target:a},t){if(!a.pageType)return!0;if(!t.pageType)return!1;let e=Array.isArray(a.pageType)?a.pageType:[a.pageType];return e.includes("all")?!0:e.includes(t.pageType)}var G=[{pageType:"product",match:a=>a.includes("/products/")},{pageType:"collection",match:a=>a.includes("/collections/")&&!a.includes("/products/")},{pageType:"account",match:a=>a.includes("/account/")||a.endsWith("/account")},{pageType:"blog",match:a=>a.includes("/blog/")},{pageType:"cart",match:a=>a.includes("/cart/")||a.endsWith("/cart")},{pageType:"wishlist",match:(a,{wishlistUrl:t})=>a.includes(t)},{pageType:"page",match:a=>a.includes("/pages/")},{pageType:"home",match:a=>a.length<4}],m=class{constructor({wishlistUrl:t}){this.wishlistUrl=t}parse(t){for(let e of G)if(e.match(t,{wishlistUrl:this.wishlistUrl}))return{pageType:e.pageType};return{pageType:void 0}}};var g=class{constructor(t){var e;this.locale=this.decodeLocale((e=t.locale)!=null?e:{})}decodeHtmlEntities(t){return t.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&#39;/g,"'")}decodeLocale(t){let e={};for(let s in t){e[s]={};for(let i in t[s])e[s][i]=this.decodeHtmlEntities(t[s][i])}return e}translate(t,e){var o;let[s,i]=t.split("."),r=(o=this.locale[s])==null?void 0:o[i];return r?e?Object.entries(e).reduce((n,[l,c])=>n.replace(new RegExp(`{{\\s*${l}\\s*}}`,"g"),c),r):r:`translation missing: ${t}`}};var d=class{constructor({rootUrl:t,wishlistUrl:e,locale:s}){this._rootUrl=t,this.route=new m({wishlistUrl:e}),this.observer=new u({routeUtil:this.route}),this.locale=new g({locale:s}),this.watch=this.observer.watch.bind(this.observer)}getPageType(t=window.location.pathname){return this.route.parse(t).pageType}getWishlistId(t){if(!t)return null;t instanceof URL&&(t=t.pathname);let e=t.replace(this._rootUrl,"/").split("/");return e.length===4?e.pop():"mine"}getProductHandle(t){var e;return t?(t instanceof URL&&(t=t.pathname),(e=t.split("/").pop())==null?void 0:e.split("?")[0]):null}getVariantId(t){return t?(t instanceof URL&&(t=t.pathname),new URLSearchParams(t.split("?")[1]).get("variant")):null}translate(t,e){return this.locale.translate(t,e)}createComponent(t,e){var i;let s=document.createElement(t);return e!=null&&e.dataset&&Object.entries(e==null?void 0:e.dataset).forEach(([r,o])=>{!o||(typeof o=="boolean"?s.dataset[r]="":typeof o=="object"?s.dataset[r]=JSON.stringify(o):s.dataset[r]=o)}),e!=null&&e.props&&Object.entries(e==null?void 0:e.props).forEach(([r,o])=>{s[r]=o}),(i=e==null?void 0:e.wrap)!=null&&i.name&&this.createElement(e.wrap.name,e.wrap.props,s),s}createElement(t,e={},...s){let i=Object.assign(document.createElement(t),e);return s&&i.append(...s),i}};var y=class{constructor(){this.dispatcher=document}publish(t){this.dispatcher.dispatchEvent(new CustomEvent(t.name,{detail:t,bubbles:!1,cancelable:!1}))}once(t,e){let s=i=>{this.dispatcher.removeEventListener(t,s),e(i)};this.subscribe(t,s)}subscribe(t,e){this.dispatcher.addEventListener(t,s=>{let i=s;e({name:i.type,data:i.detail.data})})}subscribeMany(t){return Object.entries(t).map(([e,s])=>this.subscribe(e,s))}};var q=class{constructor({dependencies:t=[],...e}){this.stylesLoaded=!1;this._loaded=!1;this.addToCart=t=>this.state.promise.addToCart(t);this.addAllToCart=t=>this.state.promise.addAllToCart(t);this.addWishlistItem=t=>this.state.promise.addWishlistItem(t);this.clearWishlist=()=>this.state.promise.clearWishlist();this.loadProductInfo=t=>this.state.promise.loadProductInfo(t);this.loadShopifyProduct=t=>this.state.promise.loadShopifyProduct(t);this.loadWishlist=t=>this.state.promise.loadWishlist(t);this.loadWishlistItem=t=>this.state.promise.loadWishlistItem(t);this.publishWishlistEvent=t=>this.state.promise.publishWishlistEvent(t);this.publishWishlistProductEvent=t=>this.state.promise.publishWishlistProductEvent(t);this.removeWishlistItem=t=>this.state.promise.removeWishlistItem(t);this.shareWishlist=t=>this.state.promise.shareWishlist(t);this.updateWishlistItem=t=>this.state.promise.updateWishlistItem(t);this.config=this.parseConfig(e),this.settings=this.parseSettings(e),this.routes=this.parseRoutes(),this.customer=this.config.customer.id?{id:this.config.customer.id,email:this.config.customer.email}:null,this.events=new y,this.theme=new d({rootUrl:this.routes.rootUrl,wishlistUrl:this.routes.wishlistUrl,locale:this.config.locale});let{stylesheets:s,scripts:i}=t.reduce(({stylesheets:r,scripts:o},n)=>{let[l]=n.split("?");return l.endsWith(".css")?r.push(n):l.endsWith(".js")&&o.push(n),{stylesheets:r,scripts:o}},{stylesheets:[],scripts:[]});this.initStyles(s),this.initScripts(i),(this.hasSession||this.settings.general.appLoading==="EAGER")&&this.load()}get loaded(){return this._loaded}get state(){return w(this._state)}get apis(){return w(this._apis)}get utils(){return w(this._utils)}get hasSession(){return!!this.getSessionId()||!!this.customer}get isLoggedIn(){var t;return!!((t=this.customer)!=null&&t.id)}getSessionId(){let t=window.localStorage.getItem("wk_session_id");if(t)return t;let e=window.localStorage.getItem("appmate-session");if(e)try{let s=JSON.parse(e).state.sid;return this.setSessionId(s)}catch(s){console.error(s)}}setSessionId(t){var e;return window.localStorage.setItem("wk_session_id",t),(e=this._apis)==null||e.tracking.setSessionId(t),t}async load(){return this._loadPromise?this._loadPromise:this._loadPromise=(async()=>{let[{WishlistState:t},{ShopifyApi:e,WishlistApi:s,TrackingApi:i},{MoneyUtil:r,UrlUtil:o,ProductUtil:n}]=await Promise.all([import("https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.4/state.js"),import("https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.4/api.js"),import("https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.4/utils.js")]);this.initUtils({MoneyUtil:r,UrlUtil:o,ProductUtil:n}),this.initApis({WishlistApi:s,ShopifyApi:e,TrackingApi:i}),this.initState({WishlistState:t}),this.initUrlChangeEvents(),this.trackCurrentPage(),this.hasSession||(await this.state.promise.clearCache(),this.events.once("wk:app:init-sid",l=>{var c,h;(c=l.data)!=null&&c.sessionId&&this.setSessionId((h=l.data)==null?void 0:h.sessionId)})),this._loaded=!0,this.events.publish({name:"wk:app:load:success"})})()}initUtils({UrlUtil:t,MoneyUtil:e,ProductUtil:s}){let i=this.config.shop.domain,r=this.config.products.fallbackImage,o=this.config.shop.moneyFormat;this._utils={url:new t({rootUrl:this.routes.rootUrl,wishlistUrl:this.routes.wishlistUrl,shopDomain:i,placeholderImageUrl:r,fileUrl:this.routes.fileUrl}),money:new e({moneyFormat:o,currencyRate:parseFloat(window.Shopify.currency.rate),activeCurrency:window.Shopify.currency.active}),product:new s}}initApis({WishlistApi:t,ShopifyApi:e,TrackingApi:s}){var i,r;this._apis={wishlist:new t({host:this.config.routes.apiHost,shop:window.Shopify.shop,customerId:(i=this.config.customer.id)!=null?i:void 0,sessionId:this.getSessionId(),trackingSource:this.theme.getPageType()}),shopify:new e({host:window.Shopify.routes.root.substring(0,window.Shopify.routes.root.length-1)}),tracking:new s({notifyHost:this.config.routes.apiHost,events:this.events,shop:window.Shopify.shop,customerId:(r=this.config.customer.id)!=null?r:void 0,sessionId:this.getSessionId(),utils:this.utils,theme:this.theme,settings:this.settings})}}initState({WishlistState:t}){this._state=new t({wishlistApi:this.apis.wishlist,shopifyApi:this.apis.shopify,settings:this.settings,events:this.events,utils:this.utils})}async initStyles(t){if(!(t!=null&&t.length)){this.onStylesLoaded();return}try{await Promise.all(t.map(e=>new Promise((s,i)=>{let r=document.createElement("link");r.rel="stylesheet",r.href=e,r.onload=s,r.onerror=i,document.head.appendChild(r)}))),this.onStylesLoaded()}catch(e){console.warn(e),this.events.publish({name:"wk:app:load-styles:error"})}}async initScripts(t){if(!(t!=null&&t.length)){this.events.publish({name:"wk:app:load-scripts:success"});return}try{await Promise.all(t.map(e=>import(e))),this.events.publish({name:"wk:app:load-scripts:success"})}catch(e){console.warn(e),this.events.publish({name:"wk:app:load-scripts:error"})}}trackCurrentPage(){if(this.theme.getPageType()==="wishlist"){let e=this.theme.getWishlistId(window.location.pathname);e&&this.publishWishlistEvent({eventName:"wk:wishlist:page-view",wishlistId:e})}}onStylesLoaded(){this.stylesLoaded=!0,this.events.publish({name:"wk:app:load-styles:success"})}initUrlChangeEvents(){let t=history.replaceState,e=({productHandle:s,variantId:i})=>{this.events.publish({name:"wk:product:change-variant:success",data:{productHandle:s,variantId:i}})};history.replaceState=(...s)=>{let i=`${window.location.protocol}//${window.location.host}`,r=typeof s[2]=="string"?new URL(s[2],i):s[2],o=t.apply(history,s);if(!r)return o;let n=this.theme.getProductHandle(r),l=r.searchParams.get("variant");if(!n||!l)return o;e({productHandle:n,variantId:parseInt(l)})}}parseConfig({config:t,locale:e}){var s,i,r,o,n,l,c,h;return{customer:{id:t.customerId?t.customerId:null,email:(s=t.customerEmail)!=null?s:""},shop:{name:(i=t.shopName)!=null?i:"",domain:(r=t.shopDomain)!=null?r:"",permanentDomain:(o=t.shopPermanentDomain)!=null?o:"",currency:(n=t.shopCurrency)!=null?n:"",moneyFormat:(l=t.shopMoneyFormat)!=null?l:"",customerAccountsEnabled:t.shopCustomerAccountsEnabled?t.shopCustomerAccountsEnabled==="true":!1},routes:{apiHost:(c=t.apiHost)!=null?c:"https://api.appmate.io/v2",rootUrl:window.Shopify.routes.root,fileUrl:t.fileUrl},products:{fallbackImage:(h=t.productFallbackImage)!=null?h:"//cdn.shopify.com/s/files/1/0533/2089/files/placeholder-images-image_large.png?format=webp&v=1530129081"},locale:e}}parseSettings({settings:t}){var e,s,i,r,o,n,l,c,h,f,b,U,S,v,P,E,W,T,A,k,I,R,L,C,_,N,H,M,O,x,D,B,j,V,F;return{general:{appLoading:(s=(e=t==null?void 0:t.general)==null?void 0:e.appLoading)!=null?s:"LAZY",wishlistAccessMode:this.config.customer.id?"UNRESTRICTED":(r=(i=t==null?void 0:t.general)==null?void 0:i.wishlistAccessMode)!=null?r:"UNRESTRICTED",wishlistMode:(n=(o=t==null?void 0:t.general)==null?void 0:o.wishlistMode)!=null?n:"PRODUCT",wishlistPath:(c=(l=t==null?void 0:t.general)==null?void 0:l.wishlistPath)!=null?c:"/apps/wishlist"},wishlistPage:{addToCartMode:(f=(h=t==null?void 0:t.wishlistPage)==null?void 0:h.addToCartMode)!=null?f:"KEEP_IN_WISHLIST",buyButtonType:(U=(b=t==null?void 0:t.wishlistPage)==null?void 0:b.buyButtonType)!=null?U:"ADD_TO_CART",shareButtonType:(v=(S=t==null?void 0:t.wishlistPage)==null?void 0:S.shareButtonType)!=null?v:"WEB_SHARE",loginHintType:(E=(P=t==null?void 0:t.wishlistPage)==null?void 0:P.loginHintType)!=null?E:"CALLOUT",variantAutoSelectMode:(T=(W=t==null?void 0:t.wishlistPage)==null?void 0:W.variantAutoSelectMode)!=null?T:"NEVER",variantSelctorType:(k=(A=t==null?void 0:t.wishlistPage)==null?void 0:A.variantSelctorType)!=null?k:"DROPDOWNS"},integrations:{googleAnalytics:{enabled:(L=(R=(I=t.integrations)==null?void 0:I.googleAnalytics)==null?void 0:R.enabled)!=null?L:!1,tracker:(N=(_=(C=t.integrations)==null?void 0:C.googleAnalytics)==null?void 0:_.tracker)!=null?N:""},klaviyo:{enabled:(O=(M=(H=t.integrations)==null?void 0:H.klaviyo)==null?void 0:M.enabled)!=null?O:!1},metaPixel:{enabled:(B=(D=(x=t.integrations)==null?void 0:x.metaPixel)==null?void 0:D.enabled)!=null?B:!1},wishlistAnalytics:{enabled:(F=(V=(j=t.integrations)==null?void 0:j.metaPixel)==null?void 0:V.enabled)!=null?F:!0}},cache:{wishlist:{ttl:6e4},wishlistItem:{ttl:6e4},productInfo:{ttl:6e4},product:{ttl:3e4}}}}parseRoutes(){let t=this.config.routes.rootUrl;return{rootUrl:t,fileUrl:this.config.routes.fileUrl,wishlistUrl:t+this.settings.general.wishlistPath.split("/").filter(e=>!!e).join("/"),accountUrl:t+"account",accountLoginUrl:t+"account/login",accountLogoutUrl:t+"account/logout",accountRegisterUrl:t+"account/register",accountAddressesUrl:t+"account/addresses",collectionsUrl:t+"collections",allProductsCollectionUrl:t+"collections/all",searchUrl:t+"search",predictiveSearchUrl:t+"search/suggest",cartUrl:t+"cart",cartAddUrl:t+"cart/add",cartChangeUrl:t+"cart/change",cartClearUrl:t+"cart/clear",cartUpdateUrl:t+"cart/update",productRecommendationsUrl:t+"recommendations/products"}}},w=a=>{if(!a)throw new Error("Wishlist app not loaded.");return a};export{q as WishlistApp};
var p=class{constructor(t){this.element=t}replace(t){var e;return(e=this.element)==null||e.replaceWith(t),t}append(t){var e;return(e=this.element)==null||e.append(t),t}prepend(t){var e;return(e=this.element)==null||e.prepend(t),t}insertBefore(t){var e;return(e=this.element)==null||e.before(t),t}insertAfter(t){var e;return(e=this.element)==null||e.after(t),t}closest(t,e=5){if(!this.element)return new p;if(typeof t=="object")return this.searchByStyle(t,this.element,i=>i.parentElement,e);let s=this.element.closest(t);return s?new p(s):new p}find(t){var s;let e=(s=this.element)==null?void 0:s.querySelector(t);return e?new p(e):new p}searchByStyle(t,e,s,i=5){if(i<0||!e)return null;let r=getComputedStyle(e);if(Object.entries(t).every(([l,c])=>r.getPropertyValue(l)===c))return new p(e);let n=s(e);return n?this.searchByStyle(t,n,s,i-1):null}};var u=class{constructor({routeUtil:t}){this.subscriber=[],this.routeUtil=t,this.observer=new MutationObserver(e=>{e.reduce((s,i)=>s.concat(Array.from(i.addedNodes)),[]).filter(s=>s instanceof Element&&!s.hasAttribute("data-appmate")).forEach(s=>this.scan(s))}),this.observer.observe(document.body,{subtree:!0,childList:!0,attributes:!1})}watch(t,e){let s={target:t,callback:e};this.subscriber.push(s),K(s,this.routeUtil.parse(window.location.pathname))&&this.scan(document.body)}shouldSkip(t,{skipHidden:e}){return e&&t instanceof HTMLElement?t.offsetParent===null:!1}scan(t){this.subscriber.filter(e=>K(e,this.routeUtil.parse(window.location.pathname))).forEach(e=>{let s=t.matches(e.target.selector)&&!this.shouldSkip(t,{skipHidden:!!e.target.skipHidden});if(s&&this.notify(e,t),s&&e.target.firstMatch)return;let i=t.querySelectorAll(e.target.selector);for(let r of i)if(!this.shouldSkip(r,{skipHidden:!!e.target.skipHidden})&&(this.notify(e,r),e.target.firstMatch))break})}notify(t,e){if(!e.hasAttribute("data-appmate")){e.setAttribute("data-appmate","");let s=new p(e);t.callback(s)}}};function K({target:a},t){if(!a.pageType)return!0;if(!t.pageType)return!1;let e=Array.isArray(a.pageType)?a.pageType:[a.pageType];return e.includes("all")?!0:e.includes(t.pageType)}var G=[{pageType:"product",match:a=>a.includes("/products/")},{pageType:"collection",match:a=>a.includes("/collections/")&&!a.includes("/products/")},{pageType:"account",match:a=>a.includes("/account/")||a.endsWith("/account")},{pageType:"blog",match:a=>a.includes("/blog/")},{pageType:"cart",match:a=>a.includes("/cart/")||a.endsWith("/cart")},{pageType:"wishlist",match:(a,{wishlistUrl:t})=>a.includes(t)},{pageType:"page",match:a=>a.includes("/pages/")},{pageType:"home",match:a=>a.length<4}],m=class{constructor({wishlistUrl:t}){this.wishlistUrl=t}parse(t){for(let e of G)if(e.match(t,{wishlistUrl:this.wishlistUrl}))return{pageType:e.pageType};return{pageType:void 0}}};var g=class{constructor(t){var e;this.locale=this.decodeLocale((e=t.locale)!=null?e:{})}decodeHtmlEntities(t){return t.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&#39;/g,"'")}decodeLocale(t){let e={};for(let s in t){e[s]={};for(let i in t[s])e[s][i]=this.decodeHtmlEntities(t[s][i])}return e}translate(t,e){var o;let[s,i]=t.split("."),r=(o=this.locale[s])==null?void 0:o[i];return r?e?Object.entries(e).reduce((n,[l,c])=>n.replace(new RegExp(`{{\\s*${l}\\s*}}`,"g"),c),r):r:`translation missing: ${t}`}};var d=class{constructor({rootUrl:t,wishlistUrl:e,locale:s}){this._rootUrl=t,this.route=new m({wishlistUrl:e}),this.observer=new u({routeUtil:this.route}),this.locale=new g({locale:s}),this.watch=this.observer.watch.bind(this.observer)}getPageType(t=window.location.pathname){return this.route.parse(t).pageType}getWishlistId(t){if(!t)return null;t instanceof URL&&(t=t.pathname);let e=t.replace(this._rootUrl,"/").split("/");return e.length===4?e.pop():"mine"}getProductHandle(t){var e;return t?(t instanceof URL&&(t=t.pathname),(e=t.split("/").pop())==null?void 0:e.split("?")[0]):null}getVariantId(t){return t?(t instanceof URL&&(t=t.pathname),new URLSearchParams(t.split("?")[1]).get("variant")):null}translate(t,e){return this.locale.translate(t,e)}createComponent(t,e){var i;let s=document.createElement(t);return e!=null&&e.dataset&&Object.entries(e==null?void 0:e.dataset).forEach(([r,o])=>{!o||(typeof o=="boolean"?s.dataset[r]="":typeof o=="object"?s.dataset[r]=JSON.stringify(o):s.dataset[r]=o)}),e!=null&&e.props&&Object.entries(e==null?void 0:e.props).forEach(([r,o])=>{s[r]=o}),(i=e==null?void 0:e.wrap)!=null&&i.name?this.createElement(e.wrap.name,e.wrap.props,s):s}createElement(t,e={},...s){let i=Object.assign(document.createElement(t),e);return s&&i.append(...s),i}};var y=class{constructor(){this.dispatcher=document}publish(t){this.dispatcher.dispatchEvent(new CustomEvent(t.name,{detail:t,bubbles:!1,cancelable:!1}))}once(t,e){let s=i=>{this.dispatcher.removeEventListener(t,s),e(i)};this.subscribe(t,s)}subscribe(t,e){this.dispatcher.addEventListener(t,s=>{let i=s;e({name:i.type,data:i.detail.data})})}subscribeMany(t){return Object.entries(t).map(([e,s])=>this.subscribe(e,s))}};var q=class{constructor({dependencies:t=[],...e}){this.stylesLoaded=!1;this._loaded=!1;this.addToCart=t=>this.state.promise.addToCart(t);this.addAllToCart=t=>this.state.promise.addAllToCart(t);this.addWishlistItem=t=>this.state.promise.addWishlistItem(t);this.clearWishlist=()=>this.state.promise.clearWishlist();this.loadProductInfo=t=>this.state.promise.loadProductInfo(t);this.loadShopifyProduct=t=>this.state.promise.loadShopifyProduct(t);this.loadWishlist=t=>this.state.promise.loadWishlist(t);this.loadWishlistItem=t=>this.state.promise.loadWishlistItem(t);this.publishWishlistEvent=t=>this.state.promise.publishWishlistEvent(t);this.publishWishlistProductEvent=t=>this.state.promise.publishWishlistProductEvent(t);this.removeWishlistItem=t=>this.state.promise.removeWishlistItem(t);this.shareWishlist=t=>this.state.promise.shareWishlist(t);this.updateWishlistItem=t=>this.state.promise.updateWishlistItem(t);this.config=this.parseConfig(e),this.settings=this.parseSettings(e),this.routes=this.parseRoutes(),this.customer=this.config.customer.id?{id:this.config.customer.id,email:this.config.customer.email}:null,this.events=new y,this.theme=new d({rootUrl:this.routes.rootUrl,wishlistUrl:this.routes.wishlistUrl,locale:this.config.locale});let{stylesheets:s,scripts:i}=t.reduce(({stylesheets:r,scripts:o},n)=>{let[l]=n.split("?");return l.endsWith(".css")?r.push(n):l.endsWith(".js")&&o.push(n),{stylesheets:r,scripts:o}},{stylesheets:[],scripts:[]});this.initStyles(s),this.initScripts(i),(this.hasSession||this.settings.general.appLoading==="EAGER")&&this.load()}get loaded(){return this._loaded}get state(){return w(this._state)}get apis(){return w(this._apis)}get utils(){return w(this._utils)}get hasSession(){return!!this.getSessionId()||!!this.customer}get isLoggedIn(){var t;return!!((t=this.customer)!=null&&t.id)}getSessionId(){let t=window.localStorage.getItem("wk_session_id");if(t)return t;let e=window.localStorage.getItem("appmate-session");if(e)try{let s=JSON.parse(e).state.sid;return this.setSessionId(s)}catch(s){console.error(s)}}setSessionId(t){var e;return window.localStorage.setItem("wk_session_id",t),(e=this._apis)==null||e.tracking.setSessionId(t),t}async load(){return this._loadPromise?this._loadPromise:this._loadPromise=(async()=>{let[{WishlistState:t},{ShopifyApi:e,WishlistApi:s,TrackingApi:i},{MoneyUtil:r,UrlUtil:o,ProductUtil:n}]=await Promise.all([import("https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.5/state.js"),import("https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.5/api.js"),import("https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.5/utils.js")]);this.initUtils({MoneyUtil:r,UrlUtil:o,ProductUtil:n}),this.initApis({WishlistApi:s,ShopifyApi:e,TrackingApi:i}),this.initState({WishlistState:t}),this.initUrlChangeEvents(),this.trackCurrentPage(),this.hasSession||(await this.state.promise.clearCache(),this.events.once("wk:app:init-sid",l=>{var c,h;(c=l.data)!=null&&c.sessionId&&this.setSessionId((h=l.data)==null?void 0:h.sessionId)})),this._loaded=!0,this.events.publish({name:"wk:app:load:success"})})()}initUtils({UrlUtil:t,MoneyUtil:e,ProductUtil:s}){let i=this.config.shop.domain,r=this.config.products.fallbackImage,o=this.config.shop.moneyFormat;this._utils={url:new t({rootUrl:this.routes.rootUrl,wishlistUrl:this.routes.wishlistUrl,shopDomain:i,placeholderImageUrl:r,fileUrl:this.routes.fileUrl}),money:new e({moneyFormat:o,currencyRate:parseFloat(window.Shopify.currency.rate),activeCurrency:window.Shopify.currency.active}),product:new s}}initApis({WishlistApi:t,ShopifyApi:e,TrackingApi:s}){var i,r;this._apis={wishlist:new t({host:this.config.routes.apiHost,shop:window.Shopify.shop,customerId:(i=this.config.customer.id)!=null?i:void 0,sessionId:this.getSessionId(),trackingSource:this.theme.getPageType()}),shopify:new e({host:window.Shopify.routes.root.substring(0,window.Shopify.routes.root.length-1)}),tracking:new s({notifyHost:this.config.routes.apiHost,events:this.events,shop:window.Shopify.shop,customerId:(r=this.config.customer.id)!=null?r:void 0,sessionId:this.getSessionId(),utils:this.utils,theme:this.theme,settings:this.settings})}}initState({WishlistState:t}){this._state=new t({wishlistApi:this.apis.wishlist,shopifyApi:this.apis.shopify,settings:this.settings,events:this.events,utils:this.utils})}async initStyles(t){if(!(t!=null&&t.length)){this.onStylesLoaded();return}try{await Promise.all(t.map(e=>new Promise((s,i)=>{let r=document.createElement("link");r.rel="stylesheet",r.href=e,r.onload=s,r.onerror=i,document.head.appendChild(r)}))),this.onStylesLoaded()}catch(e){console.warn(e),this.events.publish({name:"wk:app:load-styles:error"})}}async initScripts(t){if(!(t!=null&&t.length)){this.events.publish({name:"wk:app:load-scripts:success"});return}try{await Promise.all(t.map(e=>import(e))),this.events.publish({name:"wk:app:load-scripts:success"})}catch(e){console.warn(e),this.events.publish({name:"wk:app:load-scripts:error"})}}trackCurrentPage(){if(this.theme.getPageType()==="wishlist"){let e=this.theme.getWishlistId(window.location.pathname);e&&this.publishWishlistEvent({eventName:"wk:wishlist:page-view",wishlistId:e})}}onStylesLoaded(){this.stylesLoaded=!0,this.events.publish({name:"wk:app:load-styles:success"})}initUrlChangeEvents(){let t=history.replaceState,e=({productHandle:s,variantId:i})=>{this.events.publish({name:"wk:product:change-variant:success",data:{productHandle:s,variantId:i}})};history.replaceState=(...s)=>{let i=`${window.location.protocol}//${window.location.host}`,r=typeof s[2]=="string"?new URL(s[2],i):s[2],o=t.apply(history,s);if(!r)return o;let n=this.theme.getProductHandle(r),l=r.searchParams.get("variant");if(!n||!l)return o;e({productHandle:n,variantId:parseInt(l)})}}parseConfig({config:t,locale:e}){var s,i,r,o,n,l,c,h;return{customer:{id:t.customerId?t.customerId:null,email:(s=t.customerEmail)!=null?s:""},shop:{name:(i=t.shopName)!=null?i:"",domain:(r=t.shopDomain)!=null?r:"",permanentDomain:(o=t.shopPermanentDomain)!=null?o:"",currency:(n=t.shopCurrency)!=null?n:"",moneyFormat:(l=t.shopMoneyFormat)!=null?l:"",customerAccountsEnabled:t.shopCustomerAccountsEnabled?t.shopCustomerAccountsEnabled==="true":!1},routes:{apiHost:(c=t.apiHost)!=null?c:"https://api.appmate.io/v2",rootUrl:window.Shopify.routes.root,fileUrl:t.fileUrl},products:{fallbackImage:(h=t.productFallbackImage)!=null?h:"//cdn.shopify.com/s/files/1/0533/2089/files/placeholder-images-image_large.png?format=webp&v=1530129081"},locale:e}}parseSettings({settings:t}){var e,s,i,r,o,n,l,c,h,f,b,U,S,v,P,E,W,T,A,k,I,R,L,C,_,N,H,M,O,x,D,B,j,V,F;return{general:{appLoading:(s=(e=t==null?void 0:t.general)==null?void 0:e.appLoading)!=null?s:"LAZY",wishlistAccessMode:this.config.customer.id?"UNRESTRICTED":(r=(i=t==null?void 0:t.general)==null?void 0:i.wishlistAccessMode)!=null?r:"UNRESTRICTED",wishlistMode:(n=(o=t==null?void 0:t.general)==null?void 0:o.wishlistMode)!=null?n:"PRODUCT",wishlistPath:(c=(l=t==null?void 0:t.general)==null?void 0:l.wishlistPath)!=null?c:"/apps/wishlist"},wishlistPage:{addToCartMode:(f=(h=t==null?void 0:t.wishlistPage)==null?void 0:h.addToCartMode)!=null?f:"KEEP_IN_WISHLIST",buyButtonType:(U=(b=t==null?void 0:t.wishlistPage)==null?void 0:b.buyButtonType)!=null?U:"ADD_TO_CART",shareButtonType:(v=(S=t==null?void 0:t.wishlistPage)==null?void 0:S.shareButtonType)!=null?v:"WEB_SHARE",loginHintType:(E=(P=t==null?void 0:t.wishlistPage)==null?void 0:P.loginHintType)!=null?E:"CALLOUT",variantAutoSelectMode:(T=(W=t==null?void 0:t.wishlistPage)==null?void 0:W.variantAutoSelectMode)!=null?T:"NEVER",variantSelctorType:(k=(A=t==null?void 0:t.wishlistPage)==null?void 0:A.variantSelctorType)!=null?k:"DROPDOWNS"},integrations:{googleAnalytics:{enabled:(L=(R=(I=t.integrations)==null?void 0:I.googleAnalytics)==null?void 0:R.enabled)!=null?L:!1,tracker:(N=(_=(C=t.integrations)==null?void 0:C.googleAnalytics)==null?void 0:_.tracker)!=null?N:""},klaviyo:{enabled:(O=(M=(H=t.integrations)==null?void 0:H.klaviyo)==null?void 0:M.enabled)!=null?O:!1},metaPixel:{enabled:(B=(D=(x=t.integrations)==null?void 0:x.metaPixel)==null?void 0:D.enabled)!=null?B:!1},wishlistAnalytics:{enabled:(F=(V=(j=t.integrations)==null?void 0:j.metaPixel)==null?void 0:V.enabled)!=null?F:!0}},cache:{wishlist:{ttl:6e4},wishlistItem:{ttl:6e4},productInfo:{ttl:6e4},product:{ttl:3e4}}}}parseRoutes(){let t=this.config.routes.rootUrl;return{rootUrl:t,fileUrl:this.config.routes.fileUrl,wishlistUrl:t+this.settings.general.wishlistPath.split("/").filter(e=>!!e).join("/"),accountUrl:t+"account",accountLoginUrl:t+"account/login",accountLogoutUrl:t+"account/logout",accountRegisterUrl:t+"account/register",accountAddressesUrl:t+"account/addresses",collectionsUrl:t+"collections",allProductsCollectionUrl:t+"collections/all",searchUrl:t+"search",predictiveSearchUrl:t+"search/suggest",cartUrl:t+"cart",cartAddUrl:t+"cart/add",cartChangeUrl:t+"cart/change",cartClearUrl:t+"cart/clear",cartUpdateUrl:t+"cart/update",productRecommendationsUrl:t+"recommendations/products"}}},w=a=>{if(!a)throw new Error("Wishlist app not loaded.");return a};export{q as WishlistApp};

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

var g=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var l=(c,a,t,e)=>{for(var i=e>1?void 0:e?m(a,t):a,s=c.length-1,n;s>=0;s--)(n=c[s])&&(i=(e?n(a,t,i):n(i))||i);return e&&i&&g(a,t,i),i};import{delayWhen as y,from as p,fromEvent as h,isObservable as v,map as S,of as u}from"https://cdn.jsdelivr.net/npm/rxjs@7.5.7/+esm";import{filter as d,first as C,switchMap as E,tap as f}from"https://cdn.jsdelivr.net/npm/rxjs@7.5.7/+esm";import{state as b}from"https://cdn.jsdelivr.net/npm/@lit/reactive-element@1.4.2/decorators/+esm";import{LitElement as P}from"https://cdn.jsdelivr.net/npm/lit-element@3.2.2/lit-element/+esm";import{unsafeHTML as k}from"https://cdn.jsdelivr.net/npm/lit-html@2.4.0/directives/unsafe-html.js/+esm";import{WishlistStateController as M}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.4/controllers.js";var o=class extends P{constructor(){super();this.connected=!1;this.cleanupMethods=[];this.eventPending=!1;this.firstConnect=!0;this.state={};this.list=[];this.stateCtrl=new M(this)}get app(){return this.stateCtrl.app}static get observedAttributes(){return[...super.observedAttributes,"data-wishlist-id","data-wishlist-item-id","data-product-handle","data-product-id","data-variant-id"]}appReadyCallback(){}beforeNextState(t){}async connect(){if(!this.connected){if(!this.app.stylesLoaded){h(document,"wk:app:load-styles:success").pipe(C()).subscribe(()=>this.connect());return}this.connected=!0,this.app.loaded?this.init():this.app.hasSession?(await this.app.load(),this.init()):(this.initFallbackState(),this.app.events.once("wk:app:load:success",()=>{this.init()}))}}getStateConfig(){return{}}getTranslation(t,e){if(!this.app.theme)return t;let i=this.app.theme.translate(t,e);return t.endsWith("_html")?k(i):i}getProductUrl(t,e){return this.app.utils.url.getVariantUrl(t.url,e==null?void 0:e.id)}getImageUrl(t,e,i){var s;return this.app.utils.url.getImageUrl((s=e==null?void 0:e.featured_image)!=null&&s.src?e:t,i)}formatMoney(t){return this.app.utils.money.formatMoney(t)}init(){let{loading:t}=this.getStateConfig();t==="lazy"?(this.initFallbackState(),this.initObserver()):this.initState()}updateState(t){var e;this.state={...(e=this.state)!=null?e:{},...t}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.innerHTML&&this.firstConnect&&(this.innerHTML=""),this.initEvents(),this.connect(),this.firstConnect=!1}disconnectedCallback(){var t,e;super.disconnectedCallback(),this.cleanupMethods.forEach(i=>i()),this.connected=!1,(t=this.subscription)==null||t.unsubscribe(),(e=this.observer)==null||e.disconnect()}shouldUpdate(t){return this.connected?super.shouldUpdate(t):!1}initState(){this.subscription&&this.subscription.unsubscribe(),this.subscription=this.stateCtrl.observe().subscribe(t=>{this.updateState(t)}),this.appReadyCallback()}initFallbackState(){let t=this.stateCtrl.getFallback();t&&this.updateState(t)}initObserver(){var t,e;(t=this.observer)==null||t.disconnect(),this.observer=new IntersectionObserver(i=>this.handleIntersect(i),{root:null,rootMargin:"0px"}),this.setAttribute("wk-lazy",""),this.observer.observe((e=this.firstElementChild)!=null?e:this)}handleIntersect([t]){var e;t.isIntersecting&&(this.removeAttribute("wk-lazy"),(e=this.observer)==null||e.disconnect(),this.initState())}getEventConfig(){return{}}initEvents(){let t=this.getEventConfig();if(!t)return;let e=Object.entries(t).map(([i,s])=>{let[n,r]=i.split(/ (.*)/s);return this.subscribeToEvent({eventName:n,selector:r,handler:s})});this.cleanupMethods.push(()=>e.forEach(i=>i.unsubscribe()))}subscribeToEvent({eventName:t,handler:e,selector:i}){return h(this,t).pipe(f(s=>{this.eventPending&&s.preventDefault()}),d(()=>!this.eventPending),f(()=>{this.eventPending=!0}),S(s=>s.target instanceof HTMLElement?{event:s,target:i?s.target.closest(i):s.currentTarget}:{event:s,target:null}),d(({target:s})=>!!s),y(s=>this.app.hasSession?u(s):p(this.app.load())),E(({event:s,target:n})=>{let r=e.bind(this)(s,n);return v(r)?r:typeof(r==null?void 0:r.then)=="function"?p(r):u(r)})).subscribe(()=>{this.eventPending=!1})}};l([b()],o.prototype,"state",2),l([b()],o.prototype,"list",2);export{o as WishlistElement};
var g=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var l=(c,a,t,e)=>{for(var i=e>1?void 0:e?m(a,t):a,s=c.length-1,n;s>=0;s--)(n=c[s])&&(i=(e?n(a,t,i):n(i))||i);return e&&i&&g(a,t,i),i};import{delayWhen as y,from as p,fromEvent as h,isObservable as v,map as S,of as u}from"https://cdn.jsdelivr.net/npm/rxjs@7.5.7/+esm";import{filter as d,first as C,switchMap as E,tap as f}from"https://cdn.jsdelivr.net/npm/rxjs@7.5.7/+esm";import{state as b}from"https://cdn.jsdelivr.net/npm/@lit/reactive-element@1.4.2/decorators/+esm";import{LitElement as P}from"https://cdn.jsdelivr.net/npm/lit-element@3.2.2/lit-element/+esm";import{unsafeHTML as k}from"https://cdn.jsdelivr.net/npm/lit-html@2.4.0/directives/unsafe-html.js/+esm";import{WishlistStateController as M}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.17.5/controllers.js";var o=class extends P{constructor(){super();this.connected=!1;this.cleanupMethods=[];this.eventPending=!1;this.firstConnect=!0;this.state={};this.list=[];this.stateCtrl=new M(this)}get app(){return this.stateCtrl.app}static get observedAttributes(){return[...super.observedAttributes,"data-wishlist-id","data-wishlist-item-id","data-product-handle","data-product-id","data-variant-id"]}appReadyCallback(){}beforeNextState(t){}async connect(){if(!this.connected){if(!this.app.stylesLoaded){h(document,"wk:app:load-styles:success").pipe(C()).subscribe(()=>this.connect());return}this.connected=!0,this.app.loaded?this.init():this.app.hasSession?(await this.app.load(),this.init()):(this.initFallbackState(),this.app.events.once("wk:app:load:success",()=>{this.init()}))}}getStateConfig(){return{}}getTranslation(t,e){if(!this.app.theme)return t;let i=this.app.theme.translate(t,e);return t.endsWith("_html")?k(i):i}getProductUrl(t,e){return this.app.utils.url.getVariantUrl(t.url,e==null?void 0:e.id)}getImageUrl(t,e,i){var s;return this.app.utils.url.getImageUrl((s=e==null?void 0:e.featured_image)!=null&&s.src?e:t,i)}formatMoney(t){return this.app.utils.money.formatMoney(t)}init(){let{loading:t}=this.getStateConfig();t==="lazy"?(this.initFallbackState(),this.initObserver()):this.initState()}updateState(t){var e;this.state={...(e=this.state)!=null?e:{},...t}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.innerHTML&&this.firstConnect&&(this.innerHTML=""),this.initEvents(),this.connect(),this.firstConnect=!1}disconnectedCallback(){var t,e;super.disconnectedCallback(),this.cleanupMethods.forEach(i=>i()),this.connected=!1,(t=this.subscription)==null||t.unsubscribe(),(e=this.observer)==null||e.disconnect()}shouldUpdate(t){return this.connected?super.shouldUpdate(t):!1}initState(){this.subscription&&this.subscription.unsubscribe(),this.subscription=this.stateCtrl.observe().subscribe(t=>{this.updateState(t)}),this.appReadyCallback()}initFallbackState(){let t=this.stateCtrl.getFallback();t&&this.updateState(t)}initObserver(){var t,e;(t=this.observer)==null||t.disconnect(),this.observer=new IntersectionObserver(i=>this.handleIntersect(i),{root:null,rootMargin:"0px"}),this.setAttribute("wk-lazy",""),this.observer.observe((e=this.firstElementChild)!=null?e:this)}handleIntersect([t]){var e;t.isIntersecting&&(this.removeAttribute("wk-lazy"),(e=this.observer)==null||e.disconnect(),this.initState())}getEventConfig(){return{}}initEvents(){let t=this.getEventConfig();if(!t)return;let e=Object.entries(t).map(([i,s])=>{let[n,r]=i.split(/ (.*)/s);return this.subscribeToEvent({eventName:n,selector:r,handler:s})});this.cleanupMethods.push(()=>e.forEach(i=>i.unsubscribe()))}subscribeToEvent({eventName:t,handler:e,selector:i}){return h(this,t).pipe(f(s=>{this.eventPending&&s.preventDefault()}),d(()=>!this.eventPending),f(()=>{this.eventPending=!0}),S(s=>s.target instanceof HTMLElement?{event:s,target:i?s.target.closest(i):s.currentTarget}:{event:s,target:null}),d(({target:s})=>!!s),y(s=>this.app.hasSession?u(s):p(this.app.load())),E(({event:s,target:n})=>{let r=e.bind(this)(s,n);return v(r)?r:typeof(r==null?void 0:r.then)=="function"?p(r):u(r)})).subscribe(()=>{this.eventPending=!1})}};l([b()],o.prototype,"state",2),l([b()],o.prototype,"list",2);export{o as WishlistElement};
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc