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
213
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.20.1 to 4.20.2

2

components/badge.js

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

import{LitElement as r,html as a}from"https://cdn.jsdelivr.net/gh/lit/dist@2.6.0/all/lit-all.min.js";import{FloatingUiController as s}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.1/controllers.js";var t=class extends r{constructor(){super(...arguments);this.text="";this.layout="text-only";this.parentheses=!1;this.floatingUi=new s(this)}render(){var e,l;let o=(e=this.layout)!=null&&e.includes("text")?this.text:"",n=["wk-badge",!!this.parentheses&&"wk-parentheses",((l=this.layout)==null?void 0:l.includes("pill"))&&"wk-pill"].filter(i=>!!i).join(" ");return a`<span class=${n}>${o}</span>`}createRenderRoot(){return this}};t.properties={text:{type:String},layout:{type:String},parentheses:{type:Boolean},floating:{type:Object}};customElements.get("wk-badge")||customElements.define("wk-badge",t);export{t as Badge};
import{LitElement as r,html as a}from"https://cdn.jsdelivr.net/gh/lit/dist@2.6.0/all/lit-all.min.js";import{FloatingUiController as s}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.2/controllers.js";var t=class extends r{constructor(){super(...arguments);this.text="";this.layout="text-only";this.parentheses=!1;this.floatingUi=new s(this)}render(){var e,l;let o=(e=this.layout)!=null&&e.includes("text")?this.text:"",n=["wk-badge",!!this.parentheses&&"wk-parentheses",((l=this.layout)==null?void 0:l.includes("pill"))&&"wk-pill"].filter(i=>!!i).join(" ");return a`<span class=${n}>${o}</span>`}createRenderRoot(){return this}};t.properties={text:{type:String},layout:{type:String},parentheses:{type:Boolean},floating:{type:Object}};customElements.get("wk-badge")||customElements.define("wk-badge",t);export{t as Badge};

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

import{LitElement as h,html as l}from"https://cdn.jsdelivr.net/gh/lit/dist@2.6.0/all/lit-all.min.js";var g=Number.isNaN||function(n){return typeof n=="number"&&n!==n};function c(i,n){return!!(i===n||g(i)&&g(n))}function f(i,n){if(i.length!==n.length)return!1;for(var e=0;e<i.length;e++)if(!c(i[e],n[e]))return!1;return!0}function d(i,n){n===void 0&&(n=f);var e=null;function t(){for(var a=[],r=0;r<arguments.length;r++)a[r]=arguments[r];if(e&&e.lastThis===this&&n(a,e.lastArgs))return e.lastResult;var o=i.apply(this,a);return e={lastResult:o,lastArgs:a,lastThis:this},o}return t.clear=function(){e=null},t}import{FloatingUiController as b}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.1/controllers.js";import"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.1/components/badge.js";import"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.1/components/icon.js";var s=class extends h{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 b(this);this.getBadgeFloating=d((e,t)=>{if(!(!e||!t))return{...e,reference:t}})}get iconElement(){return this.querySelector(".wk-icon")}render(){var a,r,o;let t=["wk-button",`wk-align-${(a=this.alignment)!=null?a:"center"}`,this.selected&&"wk-selected",this.outline&&"wk-outline",this.fullWidth&&"wk-full-width"].filter(u=>!!u).join(" ");return this.href?l`
import{LitElement as h,html as l}from"https://cdn.jsdelivr.net/gh/lit/dist@2.6.0/all/lit-all.min.js";var g=Number.isNaN||function(n){return typeof n=="number"&&n!==n};function c(i,n){return!!(i===n||g(i)&&g(n))}function f(i,n){if(i.length!==n.length)return!1;for(var e=0;e<i.length;e++)if(!c(i[e],n[e]))return!1;return!0}function d(i,n){n===void 0&&(n=f);var e=null;function t(){for(var a=[],r=0;r<arguments.length;r++)a[r]=arguments[r];if(e&&e.lastThis===this&&n(a,e.lastArgs))return e.lastResult;var o=i.apply(this,a);return e={lastResult:o,lastArgs:a,lastThis:this},o}return t.clear=function(){e=null},t}import{FloatingUiController as b}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.2/controllers.js";import"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.2/components/badge.js";import"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.2/components/icon.js";var s=class extends h{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 b(this);this.getBadgeFloating=d((e,t)=>{if(!(!e||!t))return{...e,reference:t}})}get iconElement(){return this.querySelector(".wk-icon")}render(){var a,r,o;let t=["wk-button",`wk-align-${(a=this.alignment)!=null?a:"center"}`,this.selected&&"wk-selected",this.outline&&"wk-outline",this.fullWidth&&"wk-full-width"].filter(u=>!!u).join(" ");return this.href?l`
<a href=${this.href} aria-label=${(r=this.hint)!=null?r:""} class=${t}>

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

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

import{LitElement as r,html as n}from"https://cdn.jsdelivr.net/gh/lit/dist@2.6.0/all/lit-all.min.js";import{Icon as a}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.1/components/icon.js";var o=class extends r{constructor(){super();this.icon="caret"}render(){if(!this.option)return;let e=`options[${this.option.name}]`,t=`${this.id}-select`;return n`
import{LitElement as r,html as n}from"https://cdn.jsdelivr.net/gh/lit/dist@2.6.0/all/lit-all.min.js";import{Icon as a}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.2/components/icon.js";var o=class extends r{constructor(){super();this.icon="caret"}render(){if(!this.option)return;let e=`options[${this.option.name}]`,t=`${this.id}-select`;return n`
<div class="wk-option-select">

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

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

import{LitElement as s,html as o}from"https://cdn.jsdelivr.net/gh/lit/dist@2.6.0/all/lit-all.min.js";import{FloatingUiController as r}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.1/controllers.js";var n=class extends s{constructor(){super(...arguments);this.text="";this.autoShow=!1;this.autoHide=!1;this.floatingUi=new r(this)}get added(){return!!this.parentElement}get showing(){return this.transition==="show"}get hiding(){return this.transition==="hide"}render(){var e;let t=["wk-popover",this.transition?`wk-${this.transition}`:"",this.elementClass].filter(i=>!!i).join(" ");return o`
import{LitElement as s,html as o}from"https://cdn.jsdelivr.net/gh/lit/dist@2.6.0/all/lit-all.min.js";import{FloatingUiController as r}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.2/controllers.js";var n=class extends s{constructor(){super(...arguments);this.text="";this.autoShow=!1;this.autoHide=!1;this.floatingUi=new r(this)}get added(){return!!this.parentElement}get showing(){return this.transition==="show"}get hiding(){return this.transition==="hide"}render(){var e;let t=["wk-popover",this.transition?`wk-${this.transition}`:"",this.elementClass].filter(i=>!!i).join(" ");return o`
<div class=${t}>

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

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

import{LitElement as s,html as a}from"https://cdn.jsdelivr.net/gh/lit/dist@2.6.0/all/lit-all.min.js";import{Swatch as i}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.1/components/swatch.js";var t=class extends s{constructor(){super();this.label="";this.name="";this.options=[]}connectedCallback(){super.connectedCallback();for(let e of this.children)e instanceof i&&this.options.push(e);this.innerHTML=""}render(){return a`
import{LitElement as s,html as a}from"https://cdn.jsdelivr.net/gh/lit/dist@2.6.0/all/lit-all.min.js";import{Swatch as i}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.2/components/swatch.js";var t=class extends s{constructor(){super();this.label="";this.name="";this.options=[]}connectedCallback(){super.connectedCallback();for(let e of this.children)e instanceof i&&this.options.push(e);this.innerHTML=""}render(){return a`
<div class="wk-swatches">

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

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

function q(e){return e.split("-")[1]}function ot(e){return e==="y"?"height":"width"}function _(e){return e.split("-")[0]}function B(e){return["top","bottom"].includes(_(e))?"x":"y"}function gt(e,t,i){let{reference:n,floating:o}=e,a=n.x+n.width/2-o.width/2,r=n.y+n.height/2-o.height/2,s=B(t),c=ot(s),f=n[c]/2-o[c]/2,u=s==="x",l;switch(_(t)){case"top":l={x:a,y:n.y-o.height};break;case"bottom":l={x:a,y:n.y+n.height};break;case"right":l={x:n.x+n.width,y:r};break;case"left":l={x:n.x-o.width,y:r};break;default:l={x:n.x,y:n.y}}switch(q(t)){case"start":l[s]-=f*(i&&u?-1:1);break;case"end":l[s]+=f*(i&&u?-1:1)}return l}var wt=async(e,t,i)=>{let{placement:n="bottom",strategy:o="absolute",middleware:a=[],platform:r}=i,s=a.filter(Boolean),c=await(r.isRTL==null?void 0:r.isRTL(t)),f=await r.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:l}=gt(f,n,c),h=n,d={},p=0;for(let m=0;m<s.length;m++){let{name:g,fn:y}=s[m],{x:w,y:x,data:b,reset:v}=await y({x:u,y:l,initialPlacement:n,placement:h,strategy:o,middlewareData:d,rects:f,platform:r,elements:{reference:e,floating:t}});u=w!=null?w:u,l=x!=null?x:l,d={...d,[g]:{...d[g],...b}},v&&p<=50&&(p++,typeof v=="object"&&(v.placement&&(h=v.placement),v.rects&&(f=v.rects===!0?await r.getElementRects({reference:e,floating:t,strategy:o}):v.rects),{x:u,y:l}=gt(f,h,c)),m=-1)}return{x:u,y:l,placement:h,strategy:o,middlewareData:d}};function yt(e){return typeof e!="number"?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(e):{top:e,right:e,bottom:e,left:e}}function M(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function rt(e,t){var i;t===void 0&&(t={});let{x:n,y:o,platform:a,rects:r,elements:s,strategy:c}=e,{boundary:f="clippingAncestors",rootBoundary:u="viewport",elementContext:l="floating",altBoundary:h=!1,padding:d=0}=t,p=yt(d),m=s[h?l==="floating"?"reference":"floating":l],g=M(await a.getClippingRect({element:(i=await(a.isElement==null?void 0:a.isElement(m)))==null||i?m:m.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:f,rootBoundary:u,strategy:c})),y=l==="floating"?{...r.floating,x:n,y:o}:r.reference,w=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),x=await(a.isElement==null?void 0:a.isElement(w))&&await(a.getScale==null?void 0:a.getScale(w))||{x:1,y:1},b=M(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({rect:y,offsetParent:w,strategy:c}):y);return{top:(g.top-b.top+p.top)/x.y,bottom:(b.bottom-g.bottom+p.bottom)/x.y,left:(g.left-b.left+p.left)/x.x,right:(b.right-g.right+p.right)/x.x}}var Dt=Math.min,kt=Math.max;function nt(e,t,i){return kt(e,Dt(t,i))}var st=e=>({name:"arrow",options:e,async fn(t){let{element:i,padding:n=0}=e||{},{x:o,y:a,placement:r,rects:s,platform:c}=t;if(i==null)return{};let f=yt(n),u={x:o,y:a},l=B(r),h=ot(l),d=await c.getDimensions(i),p=l==="y"?"top":"left",m=l==="y"?"bottom":"right",g=s.reference[h]+s.reference[l]-u[l]-s.floating[h],y=u[l]-s.reference[l],w=await(c.getOffsetParent==null?void 0:c.getOffsetParent(i)),x=w?l==="y"?w.clientHeight||0:w.clientWidth||0:0;x===0&&(x=s.floating[h]);let b=g/2-y/2,v=f[p],L=x-d[h]-f[m],E=x/2-d[h]/2+b,V=nt(v,E,L),$=q(r)!=null&&E!=V&&s.reference[h]/2-(E<v?f[p]:f[m])-d[h]/2<0;return{[l]:u[l]-($?E<v?v-E:L-E:0),data:{[l]:V,centerOffset:E-V}}}}),zt=["top","right","bottom","left"],Jt=zt.reduce((e,t)=>e.concat(t,t+"-start",t+"-end"),[]),Mt={left:"right",right:"left",bottom:"top",top:"bottom"};function X(e){return e.replace(/left|right|bottom|top/g,t=>Mt[t])}function qt(e,t,i){i===void 0&&(i=!1);let n=q(e),o=B(e),a=ot(o),r=o==="x"?n===(i?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(r=X(r)),{main:r,cross:X(r)}}var Bt={start:"end",end:"start"};function it(e){return e.replace(/start|end/g,t=>Bt[t])}var at=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var i;let{placement:n,middlewareData:o,rects:a,initialPlacement:r,platform:s,elements:c}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:l,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:d="none",flipAlignment:p=!0,...m}=e,g=_(n),y=_(r)===r,w=await(s.isRTL==null?void 0:s.isRTL(c.floating)),x=l||(y||!p?[X(r)]:function(I){let A=X(I);return[it(I),A,it(A)]}(r));l||d==="none"||x.push(...function(I,A,D,K){let T=q(I),R=function(z,et,_t){let pt=["left","right"],mt=["right","left"],Ht=["top","bottom"],Vt=["bottom","top"];switch(z){case"top":case"bottom":return _t?et?mt:pt:et?pt:mt;case"left":case"right":return et?Ht:Vt;default:return[]}}(_(I),D==="start",K);return T&&(R=R.map(z=>z+"-"+T),A&&(R=R.concat(R.map(it)))),R}(r,p,d,w));let b=[r,...x],v=await rt(t,m),L=[],E=((i=o.flip)==null?void 0:i.overflows)||[];if(f&&L.push(v[g]),u){let{main:I,cross:A}=qt(n,a,w);L.push(v[I],v[A])}if(E=[...E,{placement:n,overflows:L}],!L.every(I=>I<=0)){var V;let I=(((V=o.flip)==null?void 0:V.index)||0)+1,A=b[I];if(A)return{data:{index:I,overflows:E},reset:{placement:A}};let D="bottom";switch(h){case"bestFit":{var $;let K=($=E.map(T=>[T,T.overflows.filter(R=>R>0).reduce((R,z)=>R+z,0)]).sort((T,R)=>T[1]-R[1])[0])==null?void 0:$[0].placement;K&&(D=K);break}case"initialPlacement":D=r}if(n!==D)return{reset:{placement:D}}}return{}}}};var Y=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){let{x:i,y:n}=t,o=await async function(a,r){let{placement:s,platform:c,elements:f}=a,u=await(c.isRTL==null?void 0:c.isRTL(f.floating)),l=_(s),h=q(s),d=B(s)==="x",p=["left","top"].includes(l)?-1:1,m=u&&d?-1:1,g=typeof r=="function"?r(a):r,{mainAxis:y,crossAxis:w,alignmentAxis:x}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...g};return h&&typeof x=="number"&&(w=h==="end"?-1*x:x),d?{x:w*m,y:y*p}:{x:y*p,y:w*m}}(t,e);return{x:i+o.x,y:n+o.y,data:o}}}};function Ut(e){return e==="x"?"y":"x"}var lt=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:i,y:n,placement:o}=t,{mainAxis:a=!0,crossAxis:r=!1,limiter:s={fn:g=>{let{x:y,y:w}=g;return{x:y,y:w}}},...c}=e,f={x:i,y:n},u=await rt(t,c),l=B(_(o)),h=Ut(l),d=f[l],p=f[h];if(a){let g=l==="y"?"bottom":"right";d=nt(d+u[l==="y"?"top":"left"],d,d-u[g])}if(r){let g=h==="y"?"bottom":"right";p=nt(p+u[h==="y"?"top":"left"],p,p-u[g])}let m=s.fn({...t,[l]:d,[h]:p});return{...m,data:{x:m.x-i,y:m.y-n}}}}};function S(e){var t;return((t=e.ownerDocument)==null?void 0:t.defaultView)||window}function P(e){return S(e).getComputedStyle(e)}function F(e){return St(e)?(e.nodeName||"").toLowerCase():""}var J;function Rt(){if(J)return J;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?(J=e.brands.map(t=>t.brand+"/"+t.version).join(" "),J):navigator.userAgent}function O(e){return e instanceof S(e).HTMLElement}function C(e){return e instanceof S(e).Element}function St(e){return e instanceof S(e).Node}function xt(e){return typeof ShadowRoot=="undefined"?!1:e instanceof S(e).ShadowRoot||e instanceof ShadowRoot}function G(e){let{overflow:t,overflowX:i,overflowY:n,display:o}=P(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+i)&&!["inline","contents"].includes(o)}function jt(e){return["table","td","th"].includes(F(e))}function ct(e){let t=/firefox/i.test(Rt()),i=P(e),n=i.backdropFilter||i.WebkitBackdropFilter;return i.transform!=="none"||i.perspective!=="none"||!!n&&n!=="none"||t&&i.willChange==="filter"||t&&!!i.filter&&i.filter!=="none"||["transform","perspective"].some(o=>i.willChange.includes(o))||["paint","layout","strict","content"].some(o=>{let a=i.contain;return a!=null&&a.includes(o)})}function Ct(){return!/^((?!chrome|android).)*safari/i.test(Rt())}function ft(e){return["html","body","#document"].includes(F(e))}var vt=Math.min,U=Math.max,Q=Math.round;function Pt(e){let t=P(e),i=parseFloat(t.width),n=parseFloat(t.height),o=e.offsetWidth,a=e.offsetHeight,r=Q(i)!==o||Q(n)!==a;return r&&(i=o,n=a),{width:i,height:n,fallback:r}}function At(e){return C(e)?e:e.contextElement}var Ot={x:1,y:1};function k(e){let t=At(e);if(!O(t))return Ot;let i=t.getBoundingClientRect(),{width:n,height:o,fallback:a}=Pt(t),r=(a?Q(i.width):i.width)/n,s=(a?Q(i.height):i.height)/o;return r&&Number.isFinite(r)||(r=1),s&&Number.isFinite(s)||(s=1),{x:r,y:s}}function H(e,t,i,n){var o,a;t===void 0&&(t=!1),i===void 0&&(i=!1);let r=e.getBoundingClientRect(),s=At(e),c=Ot;t&&(n?C(n)&&(c=k(n)):c=k(e));let f=s?S(s):window,u=!Ct()&&i,l=(r.left+(u&&((o=f.visualViewport)==null?void 0:o.offsetLeft)||0))/c.x,h=(r.top+(u&&((a=f.visualViewport)==null?void 0:a.offsetTop)||0))/c.y,d=r.width/c.x,p=r.height/c.y;if(s){let m=S(s),g=n&&C(n)?S(n):n,y=m.frameElement;for(;y&&n&&g!==m;){let w=k(y),x=y.getBoundingClientRect(),b=getComputedStyle(y);x.x+=(y.clientLeft+parseFloat(b.paddingLeft))*w.x,x.y+=(y.clientTop+parseFloat(b.paddingTop))*w.y,l*=w.x,h*=w.y,d*=w.x,p*=w.y,l+=x.x,h+=x.y,y=S(y).frameElement}}return{width:d,height:p,top:h,right:l+d,bottom:h+p,left:l,x:l,y:h}}function W(e){return((St(e)?e.ownerDocument:e.document)||window.document).documentElement}function Z(e){return C(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Wt(e){return H(W(e)).left+Z(e).scrollLeft}function Nt(e,t,i){let n=O(t),o=W(t),a=H(e,!0,i==="fixed",t),r={scrollLeft:0,scrollTop:0},s={x:0,y:0};if(n||!n&&i!=="fixed")if((F(t)!=="body"||G(o))&&(r=Z(t)),O(t)){let c=H(t,!0);s.x=c.x+t.clientLeft,s.y=c.y+t.clientTop}else o&&(s.x=Wt(o));return{x:a.left+r.scrollLeft-s.x,y:a.top+r.scrollTop-s.y,width:a.width,height:a.height}}function N(e){if(F(e)==="html")return e;let t=e.assignedSlot||e.parentNode||(xt(e)?e.host:null)||W(e);return xt(t)?t.host:t}function bt(e){return O(e)&&P(e).position!=="fixed"?e.offsetParent:null}function Et(e){let t=S(e),i=bt(e);for(;i&&jt(i)&&P(i).position==="static";)i=bt(i);return i&&(F(i)==="html"||F(i)==="body"&&P(i).position==="static"&&!ct(i))?t:i||function(n){let o=N(n);for(;O(o)&&!ft(o);){if(ct(o))return o;o=N(o)}return null}(e)||t}function Ft(e){let t=N(e);return ft(t)?e.ownerDocument.body:O(t)&&G(t)?t:Ft(t)}function j(e,t){var i;t===void 0&&(t=[]);let n=Ft(e),o=n===((i=e.ownerDocument)==null?void 0:i.body),a=S(n);return o?t.concat(a,a.visualViewport||[],G(n)?n:[]):t.concat(n,j(n))}function It(e,t,i){return t==="viewport"?M(function(n,o){let a=S(n),r=W(n),s=a.visualViewport,c=r.clientWidth,f=r.clientHeight,u=0,l=0;if(s){c=s.width,f=s.height;let h=Ct();(h||!h&&o==="fixed")&&(u=s.offsetLeft,l=s.offsetTop)}return{width:c,height:f,x:u,y:l}}(e,i)):C(t)?function(n,o){let a=H(n,!0,o==="fixed"),r=a.top+n.clientTop,s=a.left+n.clientLeft,c=O(n)?k(n):{x:1,y:1},f=n.clientWidth*c.x,u=n.clientHeight*c.y,l=s*c.x,h=r*c.y;return{top:h,left:l,right:l+f,bottom:h+u,x:l,y:h,width:f,height:u}}(t,i):M(function(n){var o;let a=W(n),r=Z(n),s=(o=n.ownerDocument)==null?void 0:o.body,c=U(a.scrollWidth,a.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),f=U(a.scrollHeight,a.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),u=-r.scrollLeft+Wt(n),l=-r.scrollTop;return P(s||a).direction==="rtl"&&(u+=U(a.clientWidth,s?s.clientWidth:0)-c),{width:c,height:f,x:u,y:l}}(W(e)))}var $t={getClippingRect:function(e){let{element:t,boundary:i,rootBoundary:n,strategy:o}=e,a=i==="clippingAncestors"?function(f,u){let l=u.get(f);if(l)return l;let h=j(f).filter(g=>C(g)&&F(g)!=="body"),d=null,p=P(f).position==="fixed",m=p?N(f):f;for(;C(m)&&!ft(m);){let g=P(m),y=ct(m);(p?y||d:y||g.position!=="static"||!d||!["absolute","fixed"].includes(d.position))?d=g:h=h.filter(w=>w!==m),m=N(m)}return u.set(f,h),h}(t,this._c):[].concat(i),r=[...a,n],s=r[0],c=r.reduce((f,u)=>{let l=It(t,u,o);return f.top=U(l.top,f.top),f.right=vt(l.right,f.right),f.bottom=vt(l.bottom,f.bottom),f.left=U(l.left,f.left),f},It(t,s,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:i,strategy:n}=e,o=O(i),a=W(i);if(i===a)return t;let r={scrollLeft:0,scrollTop:0},s={x:1,y:1},c={x:0,y:0};if((o||!o&&n!=="fixed")&&((F(i)!=="body"||G(a))&&(r=Z(i)),O(i))){let f=H(i);s=k(i),c.x=f.x+i.clientLeft,c.y=f.y+i.clientTop}return{width:t.width*s.x,height:t.height*s.y,x:t.x*s.x-r.scrollLeft*s.x+c.x,y:t.y*s.y-r.scrollTop*s.y+c.y}},isElement:C,getDimensions:function(e){return Pt(e)},getOffsetParent:Et,getDocumentElement:W,getScale:k,async getElementRects(e){let{reference:t,floating:i,strategy:n}=e,o=this.getOffsetParent||Et,a=this.getDimensions;return{reference:Nt(t,await o(i),n),floating:{x:0,y:0,...await a(i)}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>P(e).direction==="rtl"};function Lt(e,t,i,n){n===void 0&&(n={});let{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:r=!0,animationFrame:s=!1}=n,c=o&&!s,f=c||a?[...C(e)?j(e):e.contextElement?j(e.contextElement):[],...j(t)]:[];f.forEach(d=>{c&&d.addEventListener("scroll",i,{passive:!0}),a&&d.addEventListener("resize",i)});let u,l=null;if(r){let d=!0;l=new ResizeObserver(()=>{d||i(),d=!1}),C(e)&&!s&&l.observe(e),C(e)||!e.contextElement||s||l.observe(e.contextElement),l.observe(t)}let h=s?H(e):null;return s&&function d(){let p=H(e);!h||p.x===h.x&&p.y===h.y&&p.width===h.width&&p.height===h.height||i(),h=p,u=requestAnimationFrame(d)}(),i(),()=>{var d;f.forEach(p=>{c&&p.removeEventListener("scroll",i),a&&p.removeEventListener("resize",i)}),(d=l)==null||d.disconnect(),l=null,s&&cancelAnimationFrame(u)}}var Tt=(e,t,i)=>{let n=new Map,o={platform:$t,...i},a={...o.platform,_c:n};return wt(e,t,{...o,platform:a})};var ht=class{constructor(t){this._middleware=[];this._floating=!1;(this.host=t).addController(this)}hostConnected(){this.host.floating&&this.float(this.host.floating)}hostDisconnected(){this.destroy()}hostUpdated(){this.host.floating&&!this._floating&&this.float(this.host.floating),this._floating&&this.updatePosition()}hostResized(){this._floating&&this.updatePosition()}float(t){var s;if(this._floating)return;if(this._floating=!0,this._settings=t,this._reference=this.getReference(),this._resizeObserver=new ResizeObserver(()=>this.hostResized()),!this._settings)throw new Error("Floating settings are required");if(!this._reference)throw new Error("Floating reference is required");this.host.classList.add("wk-floating");let{position:i,arrow:n=!1,flip:o=!1,shift:a=!1}=this._settings,r=this.getOffsetSetting();Object.assign(this.host.style,{position:(s=i.strategy)!=null?s:"absolute",top:"0",left:"0",transition:"none",transform:"translate3d(0,0,0)"}),i.inset&&!n?this._middleware.push(Y(({rects:c,placement:f})=>{var u,l,h,d,p,m;return f.includes("top")||f.includes("bottom")?{mainAxis:-c.floating.height-((u=r==null?void 0:r.mainAxis)!=null?u:0),crossAxis:(l=r==null?void 0:r.crossAxis)!=null?l:0,alignmentAxis:(h=r==null?void 0:r.alignmentAxis)!=null?h:0}:{mainAxis:-c.floating.width-((d=r==null?void 0:r.mainAxis)!=null?d:0),crossAxis:(p=r==null?void 0:r.crossAxis)!=null?p:0,alignmentAxis:(m=r==null?void 0:r.alignmentAxis)!=null?m:0}})):r&&this._middleware.push(Y(r)),o&&this._middleware.push(at()),a&&this._middleware.push(lt()),n&&(this.arrowEl=document.createElement("div"),this.arrowEl.classList.add("wk-arrow"),this._middleware.push(st({element:this.arrowEl}))),this.cleanupAutoUpdate=Lt(this._reference,this.host,()=>{this.updatePosition()}),this._resizeObserver.observe(this.host)}getOffsetSetting(){var i,n;let t=(i=this._settings)==null?void 0:i.offset;if(!(!t||typeof t=="boolean"))return typeof t=="number"?{mainAxis:t,alignmentAxis:(n=this._settings)!=null&&n.position.inset?t:null}:t}destroy(){var t,i,n,o;this._floating&&(Object.assign(this.host.style,{position:"",top:"",left:"",transition:"",transform:""}),(i=(t=this.arrowEl)==null?void 0:t.parentElement)==null||i.removeChild(this.arrowEl),this.arrowEl=void 0,this._middleware=[],this.host.classList.remove("wk-floating"),(n=this.cleanupAutoUpdate)==null||n.call(this),(o=this._resizeObserver)==null||o.disconnect(),this._floating=!1)}updatePosition(){var n;if(!this._reference||!this._settings)return;let{strategy:t="absolute",placement:i="top"}=(n=this._settings.position)!=null?n:{};Tt(this._reference,this.host,{middleware:this._middleware,strategy:t,placement:i}).then(({x:o,y:a,placement:r,middlewareData:s})=>{if(s.arrow&&this.arrowEl){let{x:c,y:f}=s.arrow,u={top:"bottom",right:"left",bottom:"top",left:"right"}[r.split("-")[0]],l={bottom:"0deg",left:"90deg",top:"180deg",right:"270deg"}[r.split("-")[0]];Object.assign(this.arrowEl.style,{left:c!=null?`${c}px`:"",top:f!=null?`${f}px`:"",right:"",bottom:"",[u]:"-5px",transform:`rotate(${l})`})}Object.assign(this.host.style,{transform:`translate3d(${Math.round(o)}px,${Math.round(a)}px,0)`})})}getReference(){if(!this._settings)return;let t=this._settings.reference;if(typeof t=="string"){if(t==="viewport")return this.createViewportReference();let i=document.querySelector(t);if(!i)throw new Error(`Floating reference element (${t}) not found`);return i}return t.hasOwnProperty("element")?t.element:t}createViewportReference(){return{getBoundingClientRect(){var t,i,n,o;return{x:0,y:0,top:0,left:0,bottom:0,right:0,width:(i=(t=window.visualViewport)==null?void 0:t.width)!=null?i:0,height:(o=(n=window.visualViewport)==null?void 0:n.height)!=null?o:0}}}}};var ut=class{constructor(t){this.product=null;this.selectedVariant=null;this.selectedOptions={};this.hasSelection=!1;this.optionsWithValues=[];this.hasOnlyDefaultVariant=!1;(this.host=t).addController(this)}set submitting(t){var i;(i=this.host.querySelector("form"))==null||i.classList.toggle("wk-submitting",t)}get submitting(){var t,i;return(i=(t=this.host.querySelector("form"))==null?void 0:t.classList.contains("wk-submitting"))!=null?i:!1}setProduct({product:t,selectedVariantId:i,autoSelect:n=!1}){t!=null&&t.variants&&(this.product=t,this.initFormState({selectedVariantId:i,autoSelect:n}))}initFormState({selectedVariantId:t,autoSelect:i}){if(!this.product)throw new Error("Product not set");let n=this.initializedVariantId!==t?this.product.variants.find(a=>a.id===t):this.selectedVariant;this.initializedVariantId=t;let o=this.host.app.utils.product.getVariantOptions({variant:n});this.updateFormState({options:o,autoSelect:i})}updateFormState({options:t,change:i,autoSelect:n=!1}){if(!this.product)throw new Error("Product not set");let{hasSelection:o,optionsWithValues:a,selectedOptions:r,selectedVariant:s}=this.host.app.utils.product.getFormState({product:this.product,options:t,change:i,autoSelect:n});this.hasSelection=o,this.optionsWithValues=a,this.selectedOptions=r,this.selectedVariant=s,this.host.requestUpdate()}changeOption({input:t,autoSelect:i=!1}){if(!this.product)throw new Error("Product not set");let n=this.getInputOption(t);if(!n)throw new Error("Cannot parse options from input");this.updateFormState({options:this.selectedOptions,change:n,autoSelect:i})}addToCart({wishlistId:t,wishlistItemId:i}){if(!this.selectedVariant)throw new Error("No variant selected");let n=this.host.querySelector("form");if(!n)throw new Error("Form not found");return this.submitting=!0,this.host.app.addToCart({wishlistId:t,wishlistItemId:i,variantId:this.selectedVariant.id,quantity:this.host.app.utils.product.getFormQuantity({form:n})}).finally(()=>{this.submitting=!1})}getInputOption(t){if(!this.product)throw new Error("Product not set");return this.host.app.utils.product.getInputOption({input:t,product:this.product})}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}};import{combineLatest as Kt,distinctUntilChanged as Xt,map as tt,of as Yt}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";var dt=class{constructor(t){this.stateConfig={loading:"eager"};(this.host=t).addController(this)}get app(){if(!window.WishlistKing)throw new Error("Wishlist King SDK not initialized");return window.WishlistKing}get hostDataset(){return this.host.dataset?this.host.dataset:this.host.host?this.host.host.dataset:{}}hostConnected(){}hostDisconnected(){}parseStateConfig(t){var i;return{loading:(i=t.loading)!=null?i:"eager",wishlist:this.parseWishlistStateConfig(t),wishlistItem:this.parseWishlistItemStateConfig(t),productInfo:this.parseProductInfoStateConfig(t)}}parseWishlistStateConfig({wishlist:t}){var n;let i=(n=this.hostDataset.wishlistId)!=null?n:"mine";if(t)return{params:{wishlistId:i}}}parseWishlistItemStateConfig({wishlistItem:t}){let{wishlistId:i="mine",wishlistItemId:n}=this.hostDataset;if(!(!t||!n))return{params:{wishlistId:i,wishlistItemId:n}}}parseProductInfoStateConfig({productInfo:t}){if(!t)return;let{wishlistId:i="mine",productHandle:n="",productId:o,variantId:a}=this.hostDataset;return{params:{wishlistId:i,productHandle:n,variantId:a?parseInt(a):void 0}}}observe(){this.stateConfig=this.parseStateConfig(this.host.getStateConfig());let t=[];if(this.stateConfig.wishlist){let{wishlistId:i="mine"}=this.stateConfig.wishlist.params;t.push(this.app.state.observeWishlist({wishlistId:i}).pipe(tt(n=>({wishlist:n}))))}if(this.stateConfig.productInfo){let{productHandle:i,variantId:n}=this.stateConfig.productInfo.params;if(!i)throw new Error("Product handle is required");t.push(this.app.state.observeProductInfo({productHandle:i,variantId:n}).pipe(tt(o=>({productInfo:o}))))}if(this.stateConfig.wishlistItem){let{wishlistId:i,wishlistItemId:n}=this.stateConfig.wishlistItem.params;if(!i)throw new Error("Wishlist id is required");if(!n)throw new Error("Wishlist item id is required");t.push(this.app.state.observeWishlistItem({wishlistId:i,wishlistItemId:n}).pipe(tt(o=>({wishlistItem:o}))))}return t.length||t.push(Yt({})),Kt(t).pipe(tt(i=>i.reduce((n,o)=>o.wishlist?{...n,wishlist:o.wishlist}:o.wishlistItem?{...n,wishlistItem:o.wishlistItem}:o.productInfo?{...n,productInfo:o.productInfo}:n,{})),Xt((i,n)=>JSON.stringify(i)===JSON.stringify(n)))}getFallback(){this.stateConfig=this.parseStateConfig(this.host.getStateConfig());let t={};if(this.stateConfig.wishlist){let{wishlistId:i="mine"}=this.stateConfig.wishlist.params;t.wishlist={id:i,isMine:i==="mine",numItems:0,items:[]}}if(this.stateConfig.productInfo){let{variantId:i=0,productHandle:n}=this.stateConfig.productInfo.params;t.productInfo={productId:0,variantId:i,productHandle:n,inWishlist:!1}}if(this.stateConfig.wishlistItem){let{wishlistId:i,wishlistItemId:n}=this.stateConfig.wishlistItem.params;if(!i)throw new Error("Wishlist id is required");if(!n)throw new Error("Wishlist item id is required");t.wishlistItem={id:n,product:{id:0,handle:"",hidden:!1}}}return t}};export{ht as FloatingUiController,ut as ProductFormController,dt as WishlistStateController};
function q(e){return e.split("-")[1]}function ot(e){return e==="y"?"height":"width"}function _(e){return e.split("-")[0]}function B(e){return["top","bottom"].includes(_(e))?"x":"y"}function gt(e,t,i){let{reference:n,floating:o}=e,s=n.x+n.width/2-o.width/2,r=n.y+n.height/2-o.height/2,a=B(t),c=ot(a),f=n[c]/2-o[c]/2,u=a==="x",l;switch(_(t)){case"top":l={x:s,y:n.y-o.height};break;case"bottom":l={x:s,y:n.y+n.height};break;case"right":l={x:n.x+n.width,y:r};break;case"left":l={x:n.x-o.width,y:r};break;default:l={x:n.x,y:n.y}}switch(q(t)){case"start":l[a]-=f*(i&&u?-1:1);break;case"end":l[a]+=f*(i&&u?-1:1)}return l}var wt=async(e,t,i)=>{let{placement:n="bottom",strategy:o="absolute",middleware:s=[],platform:r}=i,a=s.filter(Boolean),c=await(r.isRTL==null?void 0:r.isRTL(t)),f=await r.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:l}=gt(f,n,c),h=n,d={},p=0;for(let m=0;m<a.length;m++){let{name:g,fn:y}=a[m],{x:w,y:x,data:b,reset:v}=await y({x:u,y:l,initialPlacement:n,placement:h,strategy:o,middlewareData:d,rects:f,platform:r,elements:{reference:e,floating:t}});u=w!=null?w:u,l=x!=null?x:l,d={...d,[g]:{...d[g],...b}},v&&p<=50&&(p++,typeof v=="object"&&(v.placement&&(h=v.placement),v.rects&&(f=v.rects===!0?await r.getElementRects({reference:e,floating:t,strategy:o}):v.rects),{x:u,y:l}=gt(f,h,c)),m=-1)}return{x:u,y:l,placement:h,strategy:o,middlewareData:d}};function yt(e){return typeof e!="number"?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(e):{top:e,right:e,bottom:e,left:e}}function M(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function rt(e,t){var i;t===void 0&&(t={});let{x:n,y:o,platform:s,rects:r,elements:a,strategy:c}=e,{boundary:f="clippingAncestors",rootBoundary:u="viewport",elementContext:l="floating",altBoundary:h=!1,padding:d=0}=t,p=yt(d),m=a[h?l==="floating"?"reference":"floating":l],g=M(await s.getClippingRect({element:(i=await(s.isElement==null?void 0:s.isElement(m)))==null||i?m:m.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:f,rootBoundary:u,strategy:c})),y=l==="floating"?{...r.floating,x:n,y:o}:r.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),x=await(s.isElement==null?void 0:s.isElement(w))&&await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1},b=M(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({rect:y,offsetParent:w,strategy:c}):y);return{top:(g.top-b.top+p.top)/x.y,bottom:(b.bottom-g.bottom+p.bottom)/x.y,left:(g.left-b.left+p.left)/x.x,right:(b.right-g.right+p.right)/x.x}}var Dt=Math.min,kt=Math.max;function nt(e,t,i){return kt(e,Dt(t,i))}var st=e=>({name:"arrow",options:e,async fn(t){let{element:i,padding:n=0}=e||{},{x:o,y:s,placement:r,rects:a,platform:c}=t;if(i==null)return{};let f=yt(n),u={x:o,y:s},l=B(r),h=ot(l),d=await c.getDimensions(i),p=l==="y"?"top":"left",m=l==="y"?"bottom":"right",g=a.reference[h]+a.reference[l]-u[l]-a.floating[h],y=u[l]-a.reference[l],w=await(c.getOffsetParent==null?void 0:c.getOffsetParent(i)),x=w?l==="y"?w.clientHeight||0:w.clientWidth||0:0;x===0&&(x=a.floating[h]);let b=g/2-y/2,v=f[p],L=x-d[h]-f[m],E=x/2-d[h]/2+b,V=nt(v,E,L),$=q(r)!=null&&E!=V&&a.reference[h]/2-(E<v?f[p]:f[m])-d[h]/2<0;return{[l]:u[l]-($?E<v?v-E:L-E:0),data:{[l]:V,centerOffset:E-V}}}}),zt=["top","right","bottom","left"],Jt=zt.reduce((e,t)=>e.concat(t,t+"-start",t+"-end"),[]),Mt={left:"right",right:"left",bottom:"top",top:"bottom"};function X(e){return e.replace(/left|right|bottom|top/g,t=>Mt[t])}function qt(e,t,i){i===void 0&&(i=!1);let n=q(e),o=B(e),s=ot(o),r=o==="x"?n===(i?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(r=X(r)),{main:r,cross:X(r)}}var Bt={start:"end",end:"start"};function it(e){return e.replace(/start|end/g,t=>Bt[t])}var at=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var i;let{placement:n,middlewareData:o,rects:s,initialPlacement:r,platform:a,elements:c}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:l,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:d="none",flipAlignment:p=!0,...m}=e,g=_(n),y=_(r)===r,w=await(a.isRTL==null?void 0:a.isRTL(c.floating)),x=l||(y||!p?[X(r)]:function(I){let A=X(I);return[it(I),A,it(A)]}(r));l||d==="none"||x.push(...function(I,A,D,K){let T=q(I),R=function(z,et,_t){let pt=["left","right"],mt=["right","left"],Ht=["top","bottom"],Vt=["bottom","top"];switch(z){case"top":case"bottom":return _t?et?mt:pt:et?pt:mt;case"left":case"right":return et?Ht:Vt;default:return[]}}(_(I),D==="start",K);return T&&(R=R.map(z=>z+"-"+T),A&&(R=R.concat(R.map(it)))),R}(r,p,d,w));let b=[r,...x],v=await rt(t,m),L=[],E=((i=o.flip)==null?void 0:i.overflows)||[];if(f&&L.push(v[g]),u){let{main:I,cross:A}=qt(n,s,w);L.push(v[I],v[A])}if(E=[...E,{placement:n,overflows:L}],!L.every(I=>I<=0)){var V;let I=(((V=o.flip)==null?void 0:V.index)||0)+1,A=b[I];if(A)return{data:{index:I,overflows:E},reset:{placement:A}};let D="bottom";switch(h){case"bestFit":{var $;let K=($=E.map(T=>[T,T.overflows.filter(R=>R>0).reduce((R,z)=>R+z,0)]).sort((T,R)=>T[1]-R[1])[0])==null?void 0:$[0].placement;K&&(D=K);break}case"initialPlacement":D=r}if(n!==D)return{reset:{placement:D}}}return{}}}};var Y=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){let{x:i,y:n}=t,o=await async function(s,r){let{placement:a,platform:c,elements:f}=s,u=await(c.isRTL==null?void 0:c.isRTL(f.floating)),l=_(a),h=q(a),d=B(a)==="x",p=["left","top"].includes(l)?-1:1,m=u&&d?-1:1,g=typeof r=="function"?r(s):r,{mainAxis:y,crossAxis:w,alignmentAxis:x}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...g};return h&&typeof x=="number"&&(w=h==="end"?-1*x:x),d?{x:w*m,y:y*p}:{x:y*p,y:w*m}}(t,e);return{x:i+o.x,y:n+o.y,data:o}}}};function Ut(e){return e==="x"?"y":"x"}var lt=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:i,y:n,placement:o}=t,{mainAxis:s=!0,crossAxis:r=!1,limiter:a={fn:g=>{let{x:y,y:w}=g;return{x:y,y:w}}},...c}=e,f={x:i,y:n},u=await rt(t,c),l=B(_(o)),h=Ut(l),d=f[l],p=f[h];if(s){let g=l==="y"?"bottom":"right";d=nt(d+u[l==="y"?"top":"left"],d,d-u[g])}if(r){let g=h==="y"?"bottom":"right";p=nt(p+u[h==="y"?"top":"left"],p,p-u[g])}let m=a.fn({...t,[l]:d,[h]:p});return{...m,data:{x:m.x-i,y:m.y-n}}}}};function S(e){var t;return((t=e.ownerDocument)==null?void 0:t.defaultView)||window}function P(e){return S(e).getComputedStyle(e)}function F(e){return St(e)?(e.nodeName||"").toLowerCase():""}var J;function Rt(){if(J)return J;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?(J=e.brands.map(t=>t.brand+"/"+t.version).join(" "),J):navigator.userAgent}function O(e){return e instanceof S(e).HTMLElement}function C(e){return e instanceof S(e).Element}function St(e){return e instanceof S(e).Node}function xt(e){return typeof ShadowRoot=="undefined"?!1:e instanceof S(e).ShadowRoot||e instanceof ShadowRoot}function G(e){let{overflow:t,overflowX:i,overflowY:n,display:o}=P(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+i)&&!["inline","contents"].includes(o)}function jt(e){return["table","td","th"].includes(F(e))}function ct(e){let t=/firefox/i.test(Rt()),i=P(e),n=i.backdropFilter||i.WebkitBackdropFilter;return i.transform!=="none"||i.perspective!=="none"||!!n&&n!=="none"||t&&i.willChange==="filter"||t&&!!i.filter&&i.filter!=="none"||["transform","perspective"].some(o=>i.willChange.includes(o))||["paint","layout","strict","content"].some(o=>{let s=i.contain;return s!=null&&s.includes(o)})}function Ct(){return!/^((?!chrome|android).)*safari/i.test(Rt())}function ft(e){return["html","body","#document"].includes(F(e))}var vt=Math.min,U=Math.max,Q=Math.round;function Pt(e){let t=P(e),i=parseFloat(t.width),n=parseFloat(t.height),o=e.offsetWidth,s=e.offsetHeight,r=Q(i)!==o||Q(n)!==s;return r&&(i=o,n=s),{width:i,height:n,fallback:r}}function At(e){return C(e)?e:e.contextElement}var Ot={x:1,y:1};function k(e){let t=At(e);if(!O(t))return Ot;let i=t.getBoundingClientRect(),{width:n,height:o,fallback:s}=Pt(t),r=(s?Q(i.width):i.width)/n,a=(s?Q(i.height):i.height)/o;return r&&Number.isFinite(r)||(r=1),a&&Number.isFinite(a)||(a=1),{x:r,y:a}}function H(e,t,i,n){var o,s;t===void 0&&(t=!1),i===void 0&&(i=!1);let r=e.getBoundingClientRect(),a=At(e),c=Ot;t&&(n?C(n)&&(c=k(n)):c=k(e));let f=a?S(a):window,u=!Ct()&&i,l=(r.left+(u&&((o=f.visualViewport)==null?void 0:o.offsetLeft)||0))/c.x,h=(r.top+(u&&((s=f.visualViewport)==null?void 0:s.offsetTop)||0))/c.y,d=r.width/c.x,p=r.height/c.y;if(a){let m=S(a),g=n&&C(n)?S(n):n,y=m.frameElement;for(;y&&n&&g!==m;){let w=k(y),x=y.getBoundingClientRect(),b=getComputedStyle(y);x.x+=(y.clientLeft+parseFloat(b.paddingLeft))*w.x,x.y+=(y.clientTop+parseFloat(b.paddingTop))*w.y,l*=w.x,h*=w.y,d*=w.x,p*=w.y,l+=x.x,h+=x.y,y=S(y).frameElement}}return{width:d,height:p,top:h,right:l+d,bottom:h+p,left:l,x:l,y:h}}function W(e){return((St(e)?e.ownerDocument:e.document)||window.document).documentElement}function Z(e){return C(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Wt(e){return H(W(e)).left+Z(e).scrollLeft}function Nt(e,t,i){let n=O(t),o=W(t),s=H(e,!0,i==="fixed",t),r={scrollLeft:0,scrollTop:0},a={x:0,y:0};if(n||!n&&i!=="fixed")if((F(t)!=="body"||G(o))&&(r=Z(t)),O(t)){let c=H(t,!0);a.x=c.x+t.clientLeft,a.y=c.y+t.clientTop}else o&&(a.x=Wt(o));return{x:s.left+r.scrollLeft-a.x,y:s.top+r.scrollTop-a.y,width:s.width,height:s.height}}function N(e){if(F(e)==="html")return e;let t=e.assignedSlot||e.parentNode||(xt(e)?e.host:null)||W(e);return xt(t)?t.host:t}function bt(e){return O(e)&&P(e).position!=="fixed"?e.offsetParent:null}function Et(e){let t=S(e),i=bt(e);for(;i&&jt(i)&&P(i).position==="static";)i=bt(i);return i&&(F(i)==="html"||F(i)==="body"&&P(i).position==="static"&&!ct(i))?t:i||function(n){let o=N(n);for(;O(o)&&!ft(o);){if(ct(o))return o;o=N(o)}return null}(e)||t}function Ft(e){let t=N(e);return ft(t)?e.ownerDocument.body:O(t)&&G(t)?t:Ft(t)}function j(e,t){var i;t===void 0&&(t=[]);let n=Ft(e),o=n===((i=e.ownerDocument)==null?void 0:i.body),s=S(n);return o?t.concat(s,s.visualViewport||[],G(n)?n:[]):t.concat(n,j(n))}function It(e,t,i){return t==="viewport"?M(function(n,o){let s=S(n),r=W(n),a=s.visualViewport,c=r.clientWidth,f=r.clientHeight,u=0,l=0;if(a){c=a.width,f=a.height;let h=Ct();(h||!h&&o==="fixed")&&(u=a.offsetLeft,l=a.offsetTop)}return{width:c,height:f,x:u,y:l}}(e,i)):C(t)?function(n,o){let s=H(n,!0,o==="fixed"),r=s.top+n.clientTop,a=s.left+n.clientLeft,c=O(n)?k(n):{x:1,y:1},f=n.clientWidth*c.x,u=n.clientHeight*c.y,l=a*c.x,h=r*c.y;return{top:h,left:l,right:l+f,bottom:h+u,x:l,y:h,width:f,height:u}}(t,i):M(function(n){var o;let s=W(n),r=Z(n),a=(o=n.ownerDocument)==null?void 0:o.body,c=U(s.scrollWidth,s.clientWidth,a?a.scrollWidth:0,a?a.clientWidth:0),f=U(s.scrollHeight,s.clientHeight,a?a.scrollHeight:0,a?a.clientHeight:0),u=-r.scrollLeft+Wt(n),l=-r.scrollTop;return P(a||s).direction==="rtl"&&(u+=U(s.clientWidth,a?a.clientWidth:0)-c),{width:c,height:f,x:u,y:l}}(W(e)))}var $t={getClippingRect:function(e){let{element:t,boundary:i,rootBoundary:n,strategy:o}=e,s=i==="clippingAncestors"?function(f,u){let l=u.get(f);if(l)return l;let h=j(f).filter(g=>C(g)&&F(g)!=="body"),d=null,p=P(f).position==="fixed",m=p?N(f):f;for(;C(m)&&!ft(m);){let g=P(m),y=ct(m);(p?y||d:y||g.position!=="static"||!d||!["absolute","fixed"].includes(d.position))?d=g:h=h.filter(w=>w!==m),m=N(m)}return u.set(f,h),h}(t,this._c):[].concat(i),r=[...s,n],a=r[0],c=r.reduce((f,u)=>{let l=It(t,u,o);return f.top=U(l.top,f.top),f.right=vt(l.right,f.right),f.bottom=vt(l.bottom,f.bottom),f.left=U(l.left,f.left),f},It(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:i,strategy:n}=e,o=O(i),s=W(i);if(i===s)return t;let r={scrollLeft:0,scrollTop:0},a={x:1,y:1},c={x:0,y:0};if((o||!o&&n!=="fixed")&&((F(i)!=="body"||G(s))&&(r=Z(i)),O(i))){let f=H(i);a=k(i),c.x=f.x+i.clientLeft,c.y=f.y+i.clientTop}return{width:t.width*a.x,height:t.height*a.y,x:t.x*a.x-r.scrollLeft*a.x+c.x,y:t.y*a.y-r.scrollTop*a.y+c.y}},isElement:C,getDimensions:function(e){return Pt(e)},getOffsetParent:Et,getDocumentElement:W,getScale:k,async getElementRects(e){let{reference:t,floating:i,strategy:n}=e,o=this.getOffsetParent||Et,s=this.getDimensions;return{reference:Nt(t,await o(i),n),floating:{x:0,y:0,...await s(i)}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>P(e).direction==="rtl"};function Lt(e,t,i,n){n===void 0&&(n={});let{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:r=!0,animationFrame:a=!1}=n,c=o&&!a,f=c||s?[...C(e)?j(e):e.contextElement?j(e.contextElement):[],...j(t)]:[];f.forEach(d=>{c&&d.addEventListener("scroll",i,{passive:!0}),s&&d.addEventListener("resize",i)});let u,l=null;if(r){let d=!0;l=new ResizeObserver(()=>{d||i(),d=!1}),C(e)&&!a&&l.observe(e),C(e)||!e.contextElement||a||l.observe(e.contextElement),l.observe(t)}let h=a?H(e):null;return a&&function d(){let p=H(e);!h||p.x===h.x&&p.y===h.y&&p.width===h.width&&p.height===h.height||i(),h=p,u=requestAnimationFrame(d)}(),i(),()=>{var d;f.forEach(p=>{c&&p.removeEventListener("scroll",i),s&&p.removeEventListener("resize",i)}),(d=l)==null||d.disconnect(),l=null,a&&cancelAnimationFrame(u)}}var Tt=(e,t,i)=>{let n=new Map,o={platform:$t,...i},s={...o.platform,_c:n};return wt(e,t,{...o,platform:s})};var ht=class{constructor(t){this._middleware=[];this._floating=!1;(this.host=t).addController(this)}hostConnected(){this.host.floating&&this.float(this.host.floating)}hostDisconnected(){this.destroy()}hostUpdated(){this.host.floating&&!this._floating&&this.float(this.host.floating),this._floating&&this.updatePosition()}hostResized(){this._floating&&this.updatePosition()}float(t){var a;if(this._floating)return;if(this._floating=!0,this._settings=t,this._reference=this.getReference(),this._resizeObserver=new ResizeObserver(()=>this.hostResized()),!this._settings)throw new Error("Floating settings are required");if(!this._reference)throw new Error("Floating reference is required");this.host.classList.add("wk-floating");let{position:i,arrow:n=!1,flip:o=!1,shift:s=!1}=this._settings,r=this.getOffsetSetting();Object.assign(this.host.style,{position:(a=i.strategy)!=null?a:"absolute",top:"0",left:"0",transition:"none",transform:"translate3d(0,0,0)"}),i.inset&&!n?this._middleware.push(Y(({rects:c,placement:f})=>{var u,l,h,d,p,m;return f.includes("top")||f.includes("bottom")?{mainAxis:-c.floating.height-((u=r==null?void 0:r.mainAxis)!=null?u:0),crossAxis:(l=r==null?void 0:r.crossAxis)!=null?l:0,alignmentAxis:(h=r==null?void 0:r.alignmentAxis)!=null?h:0}:{mainAxis:-c.floating.width-((d=r==null?void 0:r.mainAxis)!=null?d:0),crossAxis:(p=r==null?void 0:r.crossAxis)!=null?p:0,alignmentAxis:(m=r==null?void 0:r.alignmentAxis)!=null?m:0}})):r&&this._middleware.push(Y(r)),o&&this._middleware.push(at()),s&&this._middleware.push(lt()),n&&(this.arrowEl=document.createElement("div"),this.arrowEl.classList.add("wk-arrow"),this._middleware.push(st({element:this.arrowEl}))),this.cleanupAutoUpdate=Lt(this._reference,this.host,()=>{this.updatePosition()}),this._resizeObserver.observe(this.host)}getOffsetSetting(){var i,n;let t=(i=this._settings)==null?void 0:i.offset;if(!(!t||typeof t=="boolean"))return typeof t=="number"?{mainAxis:t,alignmentAxis:(n=this._settings)!=null&&n.position.inset?t:null}:t}destroy(){var t,i,n,o;this._floating&&(Object.assign(this.host.style,{position:"",top:"",left:"",transition:"",transform:""}),(i=(t=this.arrowEl)==null?void 0:t.parentElement)==null||i.removeChild(this.arrowEl),this.arrowEl=void 0,this._middleware=[],this.host.classList.remove("wk-floating"),(n=this.cleanupAutoUpdate)==null||n.call(this),(o=this._resizeObserver)==null||o.disconnect(),this._floating=!1)}updatePosition(){var n;if(!this._reference||!this._settings)return;let{strategy:t="absolute",placement:i="top"}=(n=this._settings.position)!=null?n:{};Tt(this._reference,this.host,{middleware:this._middleware,strategy:t,placement:i}).then(({x:o,y:s,placement:r,middlewareData:a})=>{if(a.arrow&&this.arrowEl){let{x:c,y:f}=a.arrow,u={top:"bottom",right:"left",bottom:"top",left:"right"}[r.split("-")[0]],l={bottom:"0deg",left:"90deg",top:"180deg",right:"270deg"}[r.split("-")[0]];Object.assign(this.arrowEl.style,{left:c!=null?`${c}px`:"",top:f!=null?`${f}px`:"",right:"",bottom:"",[u]:"-5px",transform:`rotate(${l})`})}Object.assign(this.host.style,{transform:`translate3d(${Math.round(o)}px,${Math.round(s)}px,0)`})})}getReference(){if(!this._settings)return;let t=this._settings.reference;if(typeof t=="string"){if(t==="viewport")return this.createViewportReference();let i=document.querySelector(t);if(!i)throw new Error(`Floating reference element (${t}) not found`);return i}return t.hasOwnProperty("element")?t.element:t}createViewportReference(){return{getBoundingClientRect(){var t,i,n,o;return{x:0,y:0,top:0,left:0,bottom:0,right:0,width:(i=(t=window.visualViewport)==null?void 0:t.width)!=null?i:0,height:(o=(n=window.visualViewport)==null?void 0:n.height)!=null?o:0}}}}};var ut=class{constructor(t){this.product=null;this.selectedVariant=null;this.selectedOptions={};this.hasSelection=!1;this.optionsWithValues=[];this.hasOnlyDefaultVariant=!1;(this.host=t).addController(this)}set submitting(t){var i;(i=this.host.querySelector("form"))==null||i.classList.toggle("wk-submitting",t)}get submitting(){var t,i;return(i=(t=this.host.querySelector("form"))==null?void 0:t.classList.contains("wk-submitting"))!=null?i:!1}setProduct({product:t,selectedVariantId:i,autoSelect:n=!1}){t!=null&&t.variants&&(this.product=t,this.initFormState({selectedVariantId:i,autoSelect:n}))}initFormState({selectedVariantId:t,autoSelect:i}){if(!this.product)throw new Error("Product not set");let n=this.initializedVariantId!==t?this.product.variants.find(s=>s.id===t):this.selectedVariant;this.initializedVariantId=t;let o=this.host.app.utils.product.getVariantOptions({variant:n});this.updateFormState({options:o,autoSelect:i})}updateFormState({options:t,change:i,autoSelect:n=!1}){if(!this.product)throw new Error("Product not set");let{hasSelection:o,optionsWithValues:s,selectedOptions:r,selectedVariant:a}=this.host.app.utils.product.getFormState({product:this.product,options:t,change:i,autoSelect:n});this.hasSelection=o,this.optionsWithValues=s,this.selectedOptions=r,this.selectedVariant=a,this.host.requestUpdate()}changeOption({input:t,autoSelect:i=!1}){if(!this.product)throw new Error("Product not set");let n=this.getInputOption(t);if(!n)throw new Error("Cannot parse options from input");this.updateFormState({options:this.selectedOptions,change:n,autoSelect:i})}addToCart({wishlistId:t,wishlistItemId:i,sectionsToRender:n,sectionsUrl:o}){if(!this.selectedVariant)throw new Error("No variant selected");let s=this.host.querySelector("form");if(!s)throw new Error("Form not found");return this.submitting=!0,this.host.app.addToCart({wishlistId:t,wishlistItemId:i,variantId:this.selectedVariant.id,quantity:this.host.app.utils.product.getFormQuantity({form:s}),sectionsToRender:n,sectionsUrl:o}).finally(()=>{this.submitting=!1})}getInputOption(t){if(!this.product)throw new Error("Product not set");return this.host.app.utils.product.getInputOption({input:t,product:this.product})}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}};import{combineLatest as Kt,distinctUntilChanged as Xt,map as tt,of as Yt}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";var dt=class{constructor(t){this.stateConfig={loading:"eager"};(this.host=t).addController(this)}get app(){if(!window.WishlistKing)throw new Error("Wishlist King SDK not initialized");return window.WishlistKing}get hostDataset(){return this.host.dataset?this.host.dataset:this.host.host?this.host.host.dataset:{}}hostConnected(){}hostDisconnected(){}parseStateConfig(t){var i;return{loading:(i=t.loading)!=null?i:"eager",wishlist:this.parseWishlistStateConfig(t),wishlistItem:this.parseWishlistItemStateConfig(t),productInfo:this.parseProductInfoStateConfig(t)}}parseWishlistStateConfig({wishlist:t}){var n;let i=(n=this.hostDataset.wishlistId)!=null?n:"mine";if(t)return{params:{wishlistId:i}}}parseWishlistItemStateConfig({wishlistItem:t}){let{wishlistId:i="mine",wishlistItemId:n}=this.hostDataset;if(!(!t||!n))return{params:{wishlistId:i,wishlistItemId:n}}}parseProductInfoStateConfig({productInfo:t}){if(!t)return;let{wishlistId:i="mine",productHandle:n="",productId:o,variantId:s}=this.hostDataset;return{params:{wishlistId:i,productHandle:n,variantId:s?parseInt(s):void 0}}}observe(){this.stateConfig=this.parseStateConfig(this.host.getStateConfig());let t=[];if(this.stateConfig.wishlist){let{wishlistId:i="mine"}=this.stateConfig.wishlist.params;t.push(this.app.state.observeWishlist({wishlistId:i}).pipe(tt(n=>({wishlist:n}))))}if(this.stateConfig.productInfo){let{productHandle:i,variantId:n}=this.stateConfig.productInfo.params;if(!i)throw new Error("Product handle is required");t.push(this.app.state.observeProductInfo({productHandle:i,variantId:n}).pipe(tt(o=>({productInfo:o}))))}if(this.stateConfig.wishlistItem){let{wishlistId:i,wishlistItemId:n}=this.stateConfig.wishlistItem.params;if(!i)throw new Error("Wishlist id is required");if(!n)throw new Error("Wishlist item id is required");t.push(this.app.state.observeWishlistItem({wishlistId:i,wishlistItemId:n}).pipe(tt(o=>({wishlistItem:o}))))}return t.length||t.push(Yt({})),Kt(t).pipe(tt(i=>i.reduce((n,o)=>o.wishlist?{...n,wishlist:o.wishlist}:o.wishlistItem?{...n,wishlistItem:o.wishlistItem}:o.productInfo?{...n,productInfo:o.productInfo}:n,{})),Xt((i,n)=>JSON.stringify(i)===JSON.stringify(n)))}getFallback(){this.stateConfig=this.parseStateConfig(this.host.getStateConfig());let t={};if(this.stateConfig.wishlist){let{wishlistId:i="mine"}=this.stateConfig.wishlist.params;t.wishlist={id:i,isMine:i==="mine",numItems:0,items:[]}}if(this.stateConfig.productInfo){let{variantId:i=0,productHandle:n}=this.stateConfig.productInfo.params;t.productInfo={productId:0,variantId:i,productHandle:n,inWishlist:!1}}if(this.stateConfig.wishlistItem){let{wishlistId:i,wishlistItemId:n}=this.stateConfig.wishlistItem.params;if(!i)throw new Error("Wishlist id is required");if(!n)throw new Error("Wishlist item id is required");t.wishlistItem={id:n,product:{id:0,handle:"",hidden:!1}}}return t}};export{ht as FloatingUiController,ut as ProductFormController,dt as WishlistStateController};
{
"name": "@appmate/wishlist",
"version": "4.20.1",
"version": "4.20.2",
"description": "Wishlist King SDK",

@@ -5,0 +5,0 @@ "main": "wishlist-app.js",

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

var h=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 h;if(typeof t=="object")return this.searchByStyle(t,this.element,i=>i.parentElement,e);let s=this.element.closest(t);return s?new h(s):new h}find(t){var s;let e=(s=this.element)==null?void 0:s.querySelector(t);return e?new h(e):new h}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 h(e);let n=s(e);return n?this.searchByStyle(t,n,s,i-1):null}};var m=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),C(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=>C(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 h(e);t.callback(s)}}};function C({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 _=[{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}],u=class{constructor({wishlistUrl:t}){this.wishlistUrl=t}parse(t){for(let e of _)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 u({wishlistUrl:e}),this.observer=new m({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}createHeadlessComponent(t,e){var r;let s=e.host.element?e.host.element:e.host;if(!s)throw new Error("Headless host is undefined");e.dataset&&Object.entries(e.dataset).forEach(([o,n])=>{n&&(typeof n=="boolean"?s.dataset[o]="":typeof n=="object"?s.dataset[o]=JSON.stringify(n):s.dataset[o]=n)});let i=(r=window.headlessElements)==null?void 0:r.store.get(t);if(!i)throw new Error(`Headless element not found: ${t}`);return new i(s)}createElement(t,e={},...s){let i=Object.assign(document.createElement(t),e);return s&&i.append(...s),i}};var f=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))}};window.headlessElements||(window.headlessElements={store:new Map,define(a,t){var e;(e=window.headlessElements)==null||e.store.set(a,t)}});var x=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 f,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(),window.WishlistKing=this,this.events.publish({name:"wk:app:created"})}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.20.1/state.js"),import("https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.1/api.js"),import("https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.1/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,p;(c=l.data)!=null&&c.sessionId&&this.setSessionId((p=l.data)==null?void 0:p.sessionId)})),this._loaded=!0,this.events.publish({name:"wk:app:load:success"})})()}initUtils({UrlUtil:t,MoneyUtil:e,ProductUtil:s}){this._utils={url:new t({rootUrl:this.routes.rootUrl,wishlistUrl:this.routes.wishlistUrl,shopDomain:this.config.shop.domain,placeholderImageUrl:this.config.products.fallbackImage,fileUrl:this.routes.fileUrl}),money:new e({moneyFormat:this.config.shop.moneyFormat,moneyFormatWithCurrency:this.config.shop.moneyFormatWithCurrency}),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(),productMetafields:this.config.products.metafields}),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,p;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:"",moneyFormat:(n=t.shopMoneyFormat)!=null?n:"",moneyFormatWithCurrency:(l=t.shopMoneyFormatWithCurrency)!=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:(p=t.productFallbackImage)!=null?p:"//cdn.shopify.com/s/files/1/0533/2089/files/placeholder-images-image_large.png?format=webp&v=1530129081",metafields:!!t.productMetafields},locale:e}}parseSettings({settings:t}){var e,s,i,r,o,n,l,c,p,y,b,U,E,W,v,S,P,T,k,A,I,L,R,M,H;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"},money:{withCurrency:(y=(p=t==null?void 0:t.money)==null?void 0:p.withCurrency)!=null?y:!1},integrations:{googleAnalytics:{enabled:(E=(U=(b=t.integrations)==null?void 0:b.googleAnalytics)==null?void 0:U.enabled)!=null?E:!1,tracker:(S=(v=(W=t.integrations)==null?void 0:W.googleAnalytics)==null?void 0:v.tracker)!=null?S:""},klaviyo:{enabled:(k=(T=(P=t.integrations)==null?void 0:P.klaviyo)==null?void 0:T.enabled)!=null?k:!1},metaPixel:{enabled:(L=(I=(A=t.integrations)==null?void 0:A.metaPixel)==null?void 0:I.enabled)!=null?L:!1},wishlistAnalytics:{enabled:(H=(M=(R=t.integrations)==null?void 0:R.metaPixel)==null?void 0:M.enabled)!=null?H:!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{x as WishlistApp};
var h=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 h;if(typeof t=="object")return this.searchByStyle(t,this.element,i=>i.parentElement,e);let s=this.element.closest(t);return s?new h(s):new h}find(t){var s;let e=(s=this.element)==null?void 0:s.querySelector(t);return e?new h(e):new h}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 h(e);let n=s(e);return n?this.searchByStyle(t,n,s,i-1):null}};var m=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),C(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=>C(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 h(e);t.callback(s)}}};function C({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 _=[{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}],u=class{constructor({wishlistUrl:t}){this.wishlistUrl=t}parse(t){for(let e of _)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 u({wishlistUrl:e}),this.observer=new m({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}createHeadlessComponent(t,e){var r;let s=e.host.element?e.host.element:e.host;if(!s)throw new Error("Headless host is undefined");e.dataset&&Object.entries(e.dataset).forEach(([o,n])=>{n&&(typeof n=="boolean"?s.dataset[o]="":typeof n=="object"?s.dataset[o]=JSON.stringify(n):s.dataset[o]=n)});let i=(r=window.headlessElements)==null?void 0:r.store.get(t);if(!i)throw new Error(`Headless element not found: ${t}`);return new i(s)}createElement(t,e={},...s){let i=Object.assign(document.createElement(t),e);return s&&i.append(...s),i}};var f=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))}};window.headlessElements||(window.headlessElements={store:new Map,define(a,t){var e;(e=window.headlessElements)==null||e.store.set(a,t)}});var x=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 f,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(),window.WishlistKing=this,this.events.publish({name:"wk:app:created"})}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.20.2/state.js"),import("https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.2/api.js"),import("https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.2/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,p;(c=l.data)!=null&&c.sessionId&&this.setSessionId((p=l.data)==null?void 0:p.sessionId)})),this._loaded=!0,this.events.publish({name:"wk:app:load:success"})})()}initUtils({UrlUtil:t,MoneyUtil:e,ProductUtil:s}){this._utils={url:new t({rootUrl:this.routes.rootUrl,wishlistUrl:this.routes.wishlistUrl,shopDomain:this.config.shop.domain,placeholderImageUrl:this.config.products.fallbackImage,fileUrl:this.routes.fileUrl}),money:new e({moneyFormat:this.config.shop.moneyFormat,moneyFormatWithCurrency:this.config.shop.moneyFormatWithCurrency}),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(),productMetafields:this.config.products.metafields}),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,p;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:"",moneyFormat:(n=t.shopMoneyFormat)!=null?n:"",moneyFormatWithCurrency:(l=t.shopMoneyFormatWithCurrency)!=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:(p=t.productFallbackImage)!=null?p:"//cdn.shopify.com/s/files/1/0533/2089/files/placeholder-images-image_large.png?format=webp&v=1530129081",metafields:!!t.productMetafields},locale:e}}parseSettings({settings:t}){var e,s,i,r,o,n,l,c,p,y,b,U,E,W,v,S,P,T,k,A,I,L,R,M,H;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"},money:{withCurrency:(y=(p=t==null?void 0:t.money)==null?void 0:p.withCurrency)!=null?y:!1},integrations:{googleAnalytics:{enabled:(E=(U=(b=t.integrations)==null?void 0:b.googleAnalytics)==null?void 0:U.enabled)!=null?E:!1,tracker:(S=(v=(W=t.integrations)==null?void 0:W.googleAnalytics)==null?void 0:v.tracker)!=null?S:""},klaviyo:{enabled:(k=(T=(P=t.integrations)==null?void 0:P.klaviyo)==null?void 0:T.enabled)!=null?k:!1},metaPixel:{enabled:(L=(I=(A=t.integrations)==null?void 0:A.metaPixel)==null?void 0:I.enabled)!=null?L:!1},wishlistAnalytics:{enabled:(H=(M=(R=t.integrations)==null?void 0:R.metaPixel)==null?void 0:M.enabled)!=null?H:!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{x as WishlistApp};

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

import{delayWhen as p,from as a,fromEvent as o,isObservable as u,map as f,of as h}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";import{filter as l,first as b,switchMap as v,tap as c}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";import{WishlistStateController as g}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.1/controllers.js";var d=class{constructor(t){this.connected=!1;this.cleanupMethods=[];this.eventPending=!1;this.firstConnect=!0;if(this.host=t,this.stateCtrl=new g(this),this.host.hasAttribute("wk-headless"))throw new Error("Headless component already initialised");this.host.setAttribute("wk-headless",""),this.initEvents(),this.connect(),this.firstConnect=!1}get app(){return this.stateCtrl.app}static get observedAttributes(){return["data-wishlist-id","data-wishlist-item-id","data-product-handle","data-product-id","data-variant-id"]}addController(t){}appReadyCallback(){this.host.dataset.productHandle&&this.app.events.subscribe("wk:product:change-variant:success",t=>{var i,n,e;if(this.host.dataset.productHandle===((i=t.data)==null?void 0:i.productHandle)&&((n=t.data)!=null&&n.variantId)){let r=this.productInfo?this.productInfo.wishlistItemId:void 0,s=this.productInfo?this.productInfo.variantId:void 0;r&&!s&&this.app.updateWishlistItem({wishlistItemId:r,changes:{variantId:(e=t.data)==null?void 0:e.variantId}}),this.host.dataset.variantId=t.data.variantId.toString(),this.connected&&this.initState()}})}async connect(){if(!this.connected){if(!this.app.stylesLoaded){o(document,"wk:app:load-styles:success").pipe(b()).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{}}init(){let{loading:t}=this.getStateConfig();t==="lazy"?(this.initFallbackState(),this.initObserver()):(this.initState(),this.appReadyCallback())}updated(){}setState(t){this.wishlist=t.wishlist,this.wishlistItem=t.wishlistItem,this.productInfo=t.productInfo,this.updated()}createRenderRoot(){return this}initState(){this.subscription&&this.subscription.unsubscribe(),this.subscription=this.stateCtrl.observe().subscribe(t=>{this.setState(t)})}initFallbackState(){let t=this.stateCtrl.getFallback();t&&this.setState(t)}initObserver(){var t;(t=this.observer)==null||t.disconnect(),this.observer=new IntersectionObserver(i=>this.handleIntersect(i),{root:null,rootMargin:"0px"}),this.host.setAttribute("wk-lazy",""),this.observer.observe(this.host)}handleIntersect([t]){var i;t.isIntersecting&&(this.host.removeAttribute("wk-lazy"),(i=this.observer)==null||i.disconnect(),this.initState(),this.appReadyCallback())}getEventConfig(){return{}}initEvents(){let t=this.getEventConfig();if(!t)return;let i=Object.entries(t).map(([n,e])=>{let[r,s]=n.split(/ (.*)/s);return this.subscribeToEvent({eventName:r,selector:s,handler:e})});this.cleanupMethods.push(()=>i.forEach(n=>n.unsubscribe()))}subscribeToEvent({eventName:t,handler:i,selector:n}){return o(this.host,t).pipe(c(e=>{this.eventPending&&e.preventDefault()}),l(()=>!this.eventPending),c(()=>{this.eventPending=!0}),f(e=>e.target instanceof HTMLElement?{event:e,target:n?e.target.closest(n):e.currentTarget}:{event:e,target:null}),l(({target:e})=>!!e),p(e=>this.app.hasSession?h(e):a(this.app.load())),v(({event:e,target:r})=>{let s=i.bind(this)(e,r);return u(s)?s:typeof(s==null?void 0:s.then)=="function"?a(s):h(s)})).subscribe(()=>{this.eventPending=!1})}};export{d as WishlistElementHeadless};
import{delayWhen as p,from as a,fromEvent as o,isObservable as u,map as f,of as h}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";import{filter as l,first as b,switchMap as v,tap as c}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";import{WishlistStateController as g}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.2/controllers.js";var d=class{constructor(t){this.connected=!1;this.cleanupMethods=[];this.eventPending=!1;this.firstConnect=!0;if(this.host=t,this.stateCtrl=new g(this),this.host.hasAttribute("wk-headless"))throw new Error("Headless component already initialised");this.host.setAttribute("wk-headless",""),this.initEvents(),this.connect(),this.firstConnect=!1}get app(){return this.stateCtrl.app}static get observedAttributes(){return["data-wishlist-id","data-wishlist-item-id","data-product-handle","data-product-id","data-variant-id"]}addController(t){}appReadyCallback(){this.host.dataset.productHandle&&this.app.events.subscribe("wk:product:change-variant:success",t=>{var i,n,e;if(this.host.dataset.productHandle===((i=t.data)==null?void 0:i.productHandle)&&((n=t.data)!=null&&n.variantId)){let r=this.productInfo?this.productInfo.wishlistItemId:void 0,s=this.productInfo?this.productInfo.variantId:void 0;r&&!s&&this.app.updateWishlistItem({wishlistItemId:r,changes:{variantId:(e=t.data)==null?void 0:e.variantId}}),this.host.dataset.variantId=t.data.variantId.toString(),this.connected&&this.initState()}})}async connect(){if(!this.connected){if(!this.app.stylesLoaded){o(document,"wk:app:load-styles:success").pipe(b()).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{}}init(){let{loading:t}=this.getStateConfig();t==="lazy"?(this.initFallbackState(),this.initObserver()):(this.initState(),this.appReadyCallback())}updated(){}setState(t){this.wishlist=t.wishlist,this.wishlistItem=t.wishlistItem,this.productInfo=t.productInfo,this.updated()}createRenderRoot(){return this}initState(){this.subscription&&this.subscription.unsubscribe(),this.subscription=this.stateCtrl.observe().subscribe(t=>{this.setState(t)})}initFallbackState(){let t=this.stateCtrl.getFallback();t&&this.setState(t)}initObserver(){var t;(t=this.observer)==null||t.disconnect(),this.observer=new IntersectionObserver(i=>this.handleIntersect(i),{root:null,rootMargin:"0px"}),this.host.setAttribute("wk-lazy",""),this.observer.observe(this.host)}handleIntersect([t]){var i;t.isIntersecting&&(this.host.removeAttribute("wk-lazy"),(i=this.observer)==null||i.disconnect(),this.initState(),this.appReadyCallback())}getEventConfig(){return{}}initEvents(){let t=this.getEventConfig();if(!t)return;let i=Object.entries(t).map(([n,e])=>{let[r,s]=n.split(/ (.*)/s);return this.subscribeToEvent({eventName:r,selector:s,handler:e})});this.cleanupMethods.push(()=>i.forEach(n=>n.unsubscribe()))}subscribeToEvent({eventName:t,handler:i,selector:n}){return o(this.host,t).pipe(c(e=>{this.eventPending&&e.preventDefault()}),l(()=>!this.eventPending),c(()=>{this.eventPending=!0}),f(e=>e.target instanceof HTMLElement?{event:e,target:n?e.target.closest(n):e.currentTarget}:{event:e,target:null}),l(({target:e})=>!!e),p(e=>this.app.hasSession?h(e):a(this.app.load())),v(({event:e,target:r})=>{let s=i.bind(this)(e,r);return u(s)?s:typeof(s==null?void 0:s.then)=="function"?a(s):h(s)})).subscribe(()=>{this.eventPending=!1})}};export{d as WishlistElementHeadless};

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

import{delayWhen as p,from as o,fromEvent as c,isObservable as f,map as b,of as h}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";import{filter as l,first as g,switchMap as m,tap as d}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";import{LitElement as y}from"https://cdn.jsdelivr.net/gh/lit/dist@2.6.0/all/lit-all.min.js";import{unsafeHTML as u}from"https://cdn.jsdelivr.net/gh/lit/dist@2.6.0/all/lit-all.min.js";import{WishlistStateController as v}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.1/controllers.js";var a=class extends y{constructor(){super();this.connected=!1;this.cleanupMethods=[];this.eventPending=!1;this.firstConnect=!0;this.stateCtrl=new v(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"]}attributeChangedCallback(t,e,i){super.attributeChangedCallback(t,e,i),this.connected&&this.app.loaded&&this.initState()}appReadyCallback(){this.dataset.productHandle&&this.app.events.subscribe("wk:product:change-variant:success",t=>{var e,i,s;if(this.dataset.productHandle===((e=t.data)==null?void 0:e.productHandle)&&((i=t.data)!=null&&i.variantId)){let n=this.productInfo?this.productInfo.wishlistItemId:void 0,r=this.productInfo?this.productInfo.variantId:void 0;n&&!r&&this.app.updateWishlistItem({wishlistItemId:n,changes:{variantId:(s=t.data)==null?void 0:s.variantId}}),this.dataset.variantId=t.data.variantId.toString()}})}async connect(){if(!this.connected){if(!window.WishlistKing){window.document.addEventListener("wk:app:created",()=>{this.connect()},{once:!0});return}if(!this.app.stylesLoaded){c(document,"wk:app:load-styles:success").pipe(g()).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")?u(i):i}formatMoney(t,e){var i;return this.app.utils.money.formatMoney(t,{withCurrency:(i=e==null?void 0:e.withCurrency)!=null?i:this.app.settings.money.withCurrency})}renderMoney(t,e){return u(this.formatMoney(t,e))}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)}init(){let{loading:t}=this.getStateConfig();t==="lazy"?(this.initFallbackState(),this.initObserver()):(this.initState(),this.appReadyCallback())}setState(t){this.wishlist=t.wishlist,this.wishlistItem=t.wishlistItem,this.productInfo=t.productInfo}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.setState(t)})}initFallbackState(){let t=this.stateCtrl.getFallback();t&&this.setState(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(),this.appReadyCallback())}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 c(this,t).pipe(d(s=>{this.eventPending&&s.preventDefault()}),l(()=>!this.eventPending),d(()=>{this.eventPending=!0}),b(s=>s.target instanceof HTMLElement?{event:s,target:i?s.target.closest(i):s.currentTarget}:{event:s,target:null}),l(({target:s})=>!!s),p(s=>this.app.hasSession?h(s):o(this.app.load())),m(({event:s,target:n})=>{let r=e.bind(this)(s,n);return f(r)?r:typeof(r==null?void 0:r.then)=="function"?o(r):h(r)})).subscribe(()=>{this.eventPending=!1})}};a.properties={wishlist:{state:!0},productInfo:{state:!0},wishlistItem:{state:!0}};export{a as WishlistElement};
import{delayWhen as p,from as o,fromEvent as c,isObservable as f,map as b,of as h}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";import{filter as l,first as g,switchMap as m,tap as d}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";import{LitElement as y}from"https://cdn.jsdelivr.net/gh/lit/dist@2.6.0/all/lit-all.min.js";import{unsafeHTML as u}from"https://cdn.jsdelivr.net/gh/lit/dist@2.6.0/all/lit-all.min.js";import{WishlistStateController as v}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.20.2/controllers.js";var a=class extends y{constructor(){super();this.connected=!1;this.cleanupMethods=[];this.eventPending=!1;this.firstConnect=!0;this.stateCtrl=new v(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"]}attributeChangedCallback(t,e,i){super.attributeChangedCallback(t,e,i),this.connected&&this.app.loaded&&this.initState()}appReadyCallback(){this.dataset.productHandle&&this.app.events.subscribe("wk:product:change-variant:success",t=>{var e,i,s;if(this.dataset.productHandle===((e=t.data)==null?void 0:e.productHandle)&&((i=t.data)!=null&&i.variantId)){let n=this.productInfo?this.productInfo.wishlistItemId:void 0,r=this.productInfo?this.productInfo.variantId:void 0;n&&!r&&this.app.updateWishlistItem({wishlistItemId:n,changes:{variantId:(s=t.data)==null?void 0:s.variantId}}),this.dataset.variantId=t.data.variantId.toString()}})}async connect(){if(!this.connected){if(!window.WishlistKing){window.document.addEventListener("wk:app:created",()=>{this.connect()},{once:!0});return}if(!this.app.stylesLoaded){c(document,"wk:app:load-styles:success").pipe(g()).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")?u(i):i}formatMoney(t,e){var i;return this.app.utils.money.formatMoney(t,{withCurrency:(i=e==null?void 0:e.withCurrency)!=null?i:this.app.settings.money.withCurrency})}renderMoney(t,e){return u(this.formatMoney(t,e))}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)}init(){let{loading:t}=this.getStateConfig();t==="lazy"?(this.initFallbackState(),this.initObserver()):(this.initState(),this.appReadyCallback())}setState(t){this.wishlist=t.wishlist,this.wishlistItem=t.wishlistItem,this.productInfo=t.productInfo}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.setState(t)})}initFallbackState(){let t=this.stateCtrl.getFallback();t&&this.setState(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(),this.appReadyCallback())}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 c(this,t).pipe(d(s=>{this.eventPending&&s.preventDefault()}),l(()=>!this.eventPending),d(()=>{this.eventPending=!0}),b(s=>s.target instanceof HTMLElement?{event:s,target:i?s.target.closest(i):s.currentTarget}:{event:s,target:null}),l(({target:s})=>!!s),p(s=>this.app.hasSession?h(s):o(this.app.load())),m(({event:s,target:n})=>{let r=e.bind(this)(s,n);return f(r)?r:typeof(r==null?void 0:r.then)=="function"?o(r):h(r)})).subscribe(()=>{this.eventPending=!1})}};a.properties={wishlist:{state:!0},productInfo:{state:!0},wishlistItem:{state:!0}};export{a 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