import{b3 as y,C as _,D as C,P as S,O as h,a4 as f,Q as b,q as M,R as k,I,v as r,g as n,i as v,l as N,B as g,j as u,S as p,F as A,m as $,U as L,X as w}from"./C_q2EfHM.js";import{_ as z}from"./BNibB90H.js";import{_ as T,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"],O=C({name:"ProductCard",components:{LappsetTag:z},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 M(e,t)},getProductLink(e,t){return k(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"),U={class:"mx-auto rounded-xl shadow-cardShadow h-full w-full max-w-screen-xs bg-white"},V={class:"relative"},D=["src"],J={key:1,class:"w-full h-auto rounded-t-xl",src:L,loading:"lazy"},B={key:2,class:"absolute bottom-0 right-4"},x={key:0,src:T,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"},X={key:0,class:"text-right flex-auto"},q={key:0,class:"font-bold text-base mb-2"},Q={class:"flex flex-wrap gap-1"};function K(e,t,a,s,i,o){var d;const c=I("LappsetTag"),l=w;return r(),n("div",U,[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",V,[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,D)):(r(),n("img",J)),e.assessment&&e.$i18n.locale==="sv-SE"?(r(),n("div",B,[e.assessment==="Accepteras"||e.assessment==="accepteras"?(r(),n("img",x)):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",X,p(e.price),1)):u("",!0)]),e.fields.name?(r(),n("span",q,p(e.getProductName(e.fields.name,e.$i18n.locale)),1)):u("",!0),g("div",Q,[(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=_(O,[["render",K]]);var W={};(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})(W);export{se as P,W as f,te as u};