import{b6 as y,D as _,E as C,P as S,Q as h,a5 as f,R as b,s as k,S as M,J as I,x as r,h as n,j as v,m as N,C as g,k as u,T as p,F as A,n as $,V as L,Y as w}from"./C_P7tFaH.js";import{_ as T}from"./Cc_aCt-i.js";import{_ as z,a as E}from"./DslTMqll.js";const te=y("userStore",{state:()=>({user:null,contentFilters:null,productMainCategories:[],activeProductMainCategory:null,activeProductSubCategory:null}),getters:{get(e){return e.user||JSON.parse(localStorage.getItem("ctUser"))},email(e){return e.user?e.user.email:null},getContentFilters(e){return e.contentFilters},getProductMainCategories(e){return e.productMainCategories},getActiveProductMainCategory(e){return e.activeProductMainCategory},getActiveProductSubCategory(e){return e.activeProductSubCategory}},actions:{set(e){this.user=e,localStorage.setItem("ctUser",JSON.stringify(e))},unset(){this.user=null,localStorage.setItem("ctUser",null)},setContentFilters(e){this.contentFilters=e,localStorage.setItem("contentFilters",JSON.stringify(e))},setProductMainCategories(e){this.productMainCategories=e,localStorage.setItem("productMainCategories",JSON.stringify(e))},unsetProductMainCategories(){this.productMainCategories=[],localStorage.setItem("productMainCategories",[])},setActiveProductMainCategory(e){this.activeProductMainCategory=e,localStorage.setItem("activeProductMainCategory",JSON.stringify(e))},unsetActiveProductMainCategory(){this.activeProductMainCategory=null,localStorage.setItem("activeProductMainCategory",null)},setActiveProductSubCategory(e){this.activeProductSubCategory=e,localStorage.setItem("activeProductSubCategory",JSON.stringify(e))},unsetActiveProductSubCategory(){this.activeProductSubCategory=null,localStorage.setItem("activeProductSubCategory",null)}}}),F=["product-is-express","product-is-configurable","product-is-inclusive","product-made-in-finland"],V=C({name:"ProductCard",components:{LappsetTag:T},props:["fields"],data(){const e=this.$i18n.locale.split("-")[1],t=this.fields.masterVariant.prices.length?this.fields.masterVariant.prices.filter(s=>s.country===e):null,a=t&&t.length?t[0].value.centAmount/100:0;return{assessment:"",pageIdentifiers:S,price:a&&h(a,this.$i18n.locale,f[this.$i18n.locale])}},methods:{eventSelectItem(){this.$gtm.trackEvent({event:"select_item",ecommerce:{items:[{item_id:this.fields.key,item_name:this.getProductName(this.fields.name,this.$i18n.locale),affiliation:`Lappset.com/${this.$i18n.locale}`}]}})},getThumbnailUrl(e="product-images",t="visualized"){var i,o,c,l,d;const a=(c=(o=(i=this.fields)==null?void 0:i.masterVariant)==null?void 0:o.attributes)==null?void 0:c.find(m=>m.name===e),s=(d=(l=this.fields)==null?void 0:l.images)==null?void 0:d.find(m=>m.default);return s&&s.file_url?s.file_url+"/preview":b(a,t)},getProductName(e,t){return k(e,t)},getProductLink(e,t){return M(e,t,this.$i18n.locale)},priceDisplay(e,t){var o;const a=f[t],s=((o=e.prices[a])==null?void 0:o.min)/100;return h(s,t,f[t])}},computed:{getProductTags(){var a,s;const e=[],t=(s=(a=this.fields)==null?void 0:a.masterVariant)==null?void 0:s.attributes;return t&&t.forEach(i=>{F.includes(i.name)&&i.value&&e.push(i.name)}),e}},created(){var t,a;const e=(a=(t=this.fields)==null?void 0:t.masterVariant)==null?void 0:a.attributes;e&&e.forEach(s=>{s.name==="product-construction-assessment"&&s.value&&(this.assessment=s.value)})}},"$9M13s8XmAc"),O={class:"mx-auto rounded-xl shadow-cardShadow h-full w-full max-w-screen-xs bg-white"},J={class:"relative"},U=["src"],D={key:1,class:"w-full h-auto rounded-t-xl",src:L,loading:"lazy"},x={key:2,class:"absolute bottom-0 right-4"},B={key:0,src:z,alt:"product",title:"product",loading:"lazy"},H={key:1,src:E,alt:"product",title:"product",loading:"lazy"},R={class:"flex flex-col text-left text-sm px-3 py-3 lg:text-md xl:text-xl"},j={class:"flex"},G={class:"text-gray-500 mb-2 flex-auto"},Q={key:0,class:"text-right flex-auto"},X={key:0,class:"font-bold text-base mb-2"},Y={class:"flex flex-wrap gap-1"};function q(e,t,a,s,i,o){var d;const c=I("LappsetTag"),l=w;return r(),n("div",O,[e.fields.key?(r(),v(l,{key:0,to:e.localePath("/"+e.getProductLink(e.fields.name,(d=e.fields.masterVariant)==null?void 0:d.sku)),onClick:e.eventSelectItem},{default:N(()=>[g("div",J,[e.getThumbnailUrl()?(r(),n("img",{key:0,src:e.getThumbnailUrl(),alt:"product image",class:"w-full h-auto rounded-t-xl",loading:"lazy"},null,8,U)):(r(),n("img",D)),e.assessment&&e.$i18n.locale==="sv-SE"?(r(),n("div",x,[e.assessment==="Accepteras"||e.assessment==="accepteras"?(r(),n("img",B)):u("",!0),e.assessment==="Rekommenderas"?(r(),n("img",H)):u("",!0)])):u("",!0)]),g("div",R,[g("div",j,[g("div",G,p(e.fields.key),1),e.price?(r(),n("div",Q,p(e.price),1)):u("",!0)]),e.fields.name?(r(),n("span",X,p(e.getProductName(e.fields.name,e.$i18n.locale)),1)):u("",!0),g("div",Y,[(r(!0),n(A,null,$(e.getProductTags,(m,P)=>(r(),v(c,{key:P,text:e.$t(m)},null,8,["text"]))),128))])])]),_:1},8,["to","onClick"])):u("",!0)])}const se=_(V,[["render",q]]);var K={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="far",a="sort",s=320,i=512,o=["unsorted"],c="f0dc",l="M70.6 176H249.4L160 86.6 70.6 176zm112-134.6l128 128c9.2 9.2 11.9 22.9 6.9 34.9s-16.6 19.8-29.6 19.8H32c-12.9 0-24.6-7.8-29.6-19.8s-2.2-25.7 6.9-34.9l128-128c12.5-12.5 32.8-12.5 45.3 0zM70.6 336L160 425.4 249.4 336H70.6zm112 134.6c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-9.2-9.2-11.9-22.9-6.9-34.9s16.6-19.8 29.6-19.8H288c12.9 0 24.6 7.8 29.6 19.8s2.2 25.7-6.9 34.9l-128 128z";e.definition={prefix:t,iconName:a,icon:[s,i,o,c,l]},e.faSort=e.definition,e.prefix=t,e.iconName=a,e.width=s,e.height=i,e.ligatures=o,e.unicode=c,e.svgPathData=l,e.aliases=o})(K);export{se as P,K as f,te as u};