1import{u as x,g as h,r as B,t as P,s as C}from"./shop-CYLfgi0D.js";import{a as m,o as F,q as r,v as s,F as L,t as S,A as i,p as o,u as y,y as c,x as l,B as R}from"./assetRecovery-H4FIcNj6.js";const j={class:"saved-products-page"},z={key:0,class:"has-text-centered py-5"},G={key:1,class:"product-grid"},M=["onClick"],N=["href"],V={class:"product-card__image"},A={key:0,class:"product-card__badge product-card__badge--brand-outlet"},H=["src","alt"],I={class:"product-card__body"},$={key:0,class:"product-card__brand"},q={class:"product-card__name"},D={key:0,class:"product-card__price-rrp"},E={key:1,class:"product-card__price-was"},O={key:2,class:"saved-products-page__empty"},T=["href"],J={__name:"SavedProductsPage",props:{initialProducts:{type:Array,default:()=>[]},isGuest:{type:Boolean,default:!1}},setup(f){const{formatPrice:u,localeUrl:v}=x(),p=f,d=m([...p.initialProducts]),_=m(p.isGuest&&h().length>0);F(async()=>{if(!p.isGuest)return;const a=h();if(!a.length){_.value=!1;return}try{const t=await fetch(`/api/saved-products/products?ids=${a.join(",")}`);if(t.ok){const e=await t.json();d.value=e.products||[];const g=d.value.map(b=>b.id);B(g)}}catch{}_.value=!1});function n(a){return parseFloat(a.special_price)>0}function k(a){return C(a.retail_price,a.price,a.brand_allow_strikethrough)}async function w(a){await P(a),d.value=d.value.filter(t=>t.id!==a)}return(a,t)=>(o(),r("div",j,[_.value?(o(),r("div",z,[...t[0]||(t[0]=[s("p",{class:"has-text-grey"},"Loading your saved productsâ¦",-1)])])):d.value.length?(o(),r("div",G,[(o(!0),r(L,null,S(d.value,e=>(o(),r("div",{key:e.id,class:y(["product-card saved-products-page__card",{"product-card--brand-outlet":n(e)}])},[s("button",{class:"save-product-btn save-product-btn--saved saved-products-page__remove",title:"Remove",onClick:g=>w(e.id)},[...t[1]||(t[1]=[s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[s("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"})],-1)])],8,M),s("a",{href:i(v)("/"+e.slug),class:"saved-products-page__link"},[s("div",V,[n(e)?(o(),r("span",A,"Brand Outlet")):c("",!0),s("img",{src:e.image_url||"/images/placeholder.svg",alt:e.name,width:"300",height:"300",loading:"lazy",class:"product-card__img"},null,8,H)]),s("div",I,[e.brand?(o(),r("p",$,l(e.brand),1)):c("",!0),s("h3",q,l(e.name),1),s("p",{class:y(["product-card__price",{"product-card__price--outlet":n(e)}])},[k(e)?(o(),r("span",D,"RRP "+l(i(u)(parseFloat(e.retail_price))),1)):c("",!0),n(e)?(o(),r("span",E,l(i(u)(parseFloat(e.selling_price))),1)):c("",!0),R(" "+l(i(u)(parseFloat(e.price))),1)],2)])],8,N)],2))),128))])):(o(),r("div",O,[t[2]||(t[2]=s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round",class:"saved-products-page__empty-icon"},[s("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"})],-1)),t[3]||(t[3]=s("p",{class:"saved-products-page__empty-text"},"You haven't saved any products yet.",-1)),s("a",{href:i(v)("/"),class:"button is-primary is-outlined is-small"},"Browse Products",8,T)]))]))}};export{J as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.