import{_ as ct}from"./D87SlFqb.js";import{x as ne,u as ge,w as ee,l as te,X as dt,r as O,o as n,g as r,F as X,B as Z,i as I,H as U,f as l,k as _,h as e,R as K,_ as Ke,S as D,N as Q,K as H,L as R,Y as mt,z as T,n as B,j,U as Xe,s as ve,b as ae,y as pt,a as Ze,V as _t,m as me,c as Qe,Z as gt,$ as vt,q as ft,a0 as pe,a1 as yt,a2 as L,a3 as _e,M as A,C as G,a4 as ht,a5 as bt,Q as kt,a6 as $t,a7 as xt,O as Et,a8 as wt,I as It,v as Ct,a9 as Pt,E as Ft,aa as Vt}from"./B7moA0Zy.js";import{J as Tt,_ as Ot,a as St}from"./iNjw5Am8.js";import{u as qt}from"./CkrK4Ify.js";import{u as Ut}from"./CQOTW_ES.js";import"./CdxtG-CO.js";import"./CM9z76KS.js";import"./CnjcqSsV.js";const jt={class:K(["transparent","product-selector"])},Bt={__name:"Selector",props:{data:{type:Object},modelValue:{type:Object}},emits:["update:modelValue","no-selector"],async setup(E,{emit:c}){let a,i;const d=E,u=c,{collection:y}=d.data,{locale:x}=ge(),{data:m}=([a,i]=ee(()=>te({key:`products-${y.slug}`,query:dt,variables:{site:x.value,collections:[y.slug]}})),a=await a,i(),a);(m==null?void 0:m.value.products.length)<=1&&u("no-selector");const h=new Set([...y.sortingProducts.flatMap(s=>(m==null?void 0:m.value.products.find(g=>g.id===s.id))||[]),...(m==null?void 0:m.value.products)||[]]);return(s,k)=>{const g=Ke,b=D,C=Q,p=O("lay");return n(),r("div",jt,[(n(!0),r(X,null,Z(e(h),w=>(n(),I(C,{class:"thumb-hover-boxed",key:w.id,onClick:N=>s.$emit("update:modelValue",w),data:{themes:["button","white-button","image"],active:E.modelValue.slug===w.slug}},{default:U(()=>[l((n(),r("div",null,[_(g,{data:{image:w.mainImage,ratio:[1,1],theme:"selector"}},null,8,["data"]),_(b,{style:{zIndex:1},data:{heading:w.label,typo:"4"}},null,8,["data"])])),[[p,{dir:"o",align:"start"}]])]),_:2},1032,["onClick","data"]))),128))])}}},Nt=ne(Bt,[["__scopeId","data-v-90a08f51"]]),zt={__name:"Complementary",props:{data:{type:Object}},setup(E){return(c,a)=>{const i=D,d=Q,u=O("lay");return l((n(),r("div",null,[_(i,{data:{heading:c.$t("complementary"),typo:4,color:"grey"}},null,8,["data"]),l((n(),r("div",null,[(n(!0),r(X,null,Z(E.data.complementary,y=>(n(),I(d,{data:{themes:["button","white-button","border","icon"],url:y.url}},{default:U(()=>[H(R(y.sku),1)]),_:2},1032,["data"]))),256))])),[[u,{dir:"h",gap:"m",align:"start",fluid:!0}]])])),[[u,{gap:"xs"}]])}}},Mt={__name:"Attributes",props:{data:{type:Object}},setup(E){return(c,a)=>{const i=D,d=mt,u=O("lay");return l((n(),r("div",null,[_(i,{data:{heading:c.$t("attributes"),typo:4,color:"grey"}},null,8,["data"]),l((n(),r("div",null,[(n(!0),r(X,null,Z(E.data.attributes,y=>(n(),I(d,{data:{theme:"white"}},{default:U(()=>[H(R(y.title),1)]),_:2},1024))),256))])),[[u,{dir:"h",gap:"m",align:"start",fluid:!0}]])])),[[u,{gap:"xs"}]])}}},We={__name:"Files",props:{data:{type:Object},productImages:{type:Object}},emits:["updateUrl"],setup(E,{emit:c}){const a=E,{t:i}=ge(),d=T(),u=new Map([["files_pdf_BlockType","pdf"],["files_cad_BlockType","cad"],["files_manual_BlockType","manual"],["files_model_BlockType","model"],["files_bim_BlockType","bim"]]),y=h=>(h==null?void 0:h.filter(s=>s.assetUrl[0]).map(s=>({type:u.get(s.__typename),key:u.get(s.__typename),id:u.get(s.__typename),text:i(u.get(s.__typename)),value:s.assetUrl[0].url})))||[],x=B(()=>{let h=y(a.data.productFiles),k=[...y(a.data.variantFiles)];return h.forEach(b=>{k.find(C=>b.type===C.type)||k.push(b)}),k=["pdf","manual","cad","model","bim"].flatMap(b=>k.find(C=>C.type===b)||[]),k});async function m(){var s,k;if(!((s=a.productImages)!=null&&s.images.length))return;if(!d.value){const g=await Promise.all((k=a.productImages)==null?void 0:k.images.map(p=>fetch(p.url))),b=new Tt;g.forEach((p,w)=>{var z;const N=p.headers.get("content-type").split("/")[1],v=`${(z=a.productImages)==null?void 0:z.images[w].name}.${N}`;b.file(v,p.blob(),{binary:!0})});const C=await b.generateAsync({type:"blob"});d.value=URL.createObjectURL(C)}const h=document.createElement("a");h.href=d.value,h.download=`${a.productImages.name}.zip`,h.click()}return(h,s)=>{var C,p;const k=D,g=Q,b=O("lay");return l((n(),r("div",null,[_(k,{data:{heading:h.$t("files_message"),typo:4,color:"grey"}},null,8,["data"]),l((n(),r("div",null,[(n(!0),r(X,null,Z(e(x),w=>(n(),I(g,{key:w.value,data:{themes:["button","light-button"],url:w.value},download:""},{default:U(()=>[H(R(w.text),1)]),_:2},1032,["data"]))),128)),(p=(C=E.productImages)==null?void 0:C.images)!=null&&p.length?(n(),I(g,{key:0,data:{themes:["button","light-button"]},onClick:m},{default:U(()=>[H(R(h.$t("product_images")),1)]),_:1})):j("",!0)])),[[b,{gap:"xxs"}]])])),[[b,{gap:"m"}]])}}},Lt={class:"box-container files-modal"},Ht={__name:"Files",props:{data:{type:Object}},setup(E){const c=T("");return(a,i)=>{var h;const d=D,u=Xe,y=We,x=O("pad"),m=O("lay");return l((n(),r("div",Lt,[l((n(),r("div",null,[l((n(),r("div",null,[_(d,{data:{heading:a.$t("files")}},null,8,["data"]),l(_(u,{onClick:i[0]||(i[0]=s=>a.$emit("close-modal")),data:{name:"cross",color:"grey",size:"m"}},null,512),[[x,"m"]])])),[[m,{dir:"h",align:["center","even"],fluid:!0}],[x,"m"]]),l(_(y,{onUpdateUrl:i[1]||(i[1]=s=>c.value=s),data:{id:"mobile-files",productFiles:E.data.product.files,variantFiles:(h=E.data.current)==null?void 0:h.files}},null,8,["data"]),[[x,"m"]])])),[[m,{align:["even"],fluid:!0}]])])),[[m]])}}},Rt=ne(Ht,[["__scopeId","data-v-6102267a"]]),At={__name:"Favorites",props:{data:{type:Object}},setup(E){const c=E,{snackbar:a}=ve(ae()),i=pt("zk",{favorites:[]}),d=B(()=>i.value.favorites.includes(c.data.sku));function u(){d.value?i.value.favorites=i.value.favorites.filter(y=>y!==c.data.sku):(i.value.favorites=[...i.value.favorites,c.data.sku],a.value="favorites-added")}return(y,x)=>{const m=Q;return n(),I(m,{onClick:u,data:{themes:["button","white-button"],align:"center",disabled:e(d)},class:"favorites-button"},{default:U(()=>[H(R(e(d)?y.$t("favorites_added"):y.$t("favorites_add")),1)]),_:1},8,["data"])}}},Dt=ne(At,[["__scopeId","data-v-852b88eb"]]),Jt={class:"main box-container"},Kt={key:0,style:{overflowX:"auto"}},Xt={class:"box"},Zt={class:"box-content"},Qt={key:1},Wt={__name:"Product",props:{data:{type:Object}},setup(E){var we,Ie,Ce;const c=E,a=T(c.data.product),i=a.value.__typename.split("_")[0]==="kos",d=a.value.mainProduct,{collection:u}=c.data,y=Ze();_t(),me(()=>a.value.slug,()=>{Qe(a.value,"overlay")});const x=B(()=>a.value.variants.filter(t=>t.variantStatus).map(t=>({...t,finishing:t.parts.filter(o=>o.swatch).map(o=>{var $;return($=o.finishing[0])==null?void 0:$.code}).join("-")}))),m=B(()=>{let t=[];const o=[];t=x.value.filter(P=>{const V=P.finishing;if(V&&!o.includes(V))return o.push(V),!0});const S=[...t].sort((P,V)=>V.parts.length-P.parts.length)[0],q=S==null?void 0:S.parts.filter(P=>P.partName!=="Primaria"&&P.partName!=="Secondaria");return q!=null&&q.length?t.map(P=>{const V=P.parts;return q.forEach(Y=>{V.find(re=>re.partName===Y.partName)||V.push({...Y,swatch:!1})}),{...P,parts:V}}):t}),h=a.value.model.length&&m.value.length&&m.value[0].parts.length,s=y.query.sku,k=B(()=>i?c.data.allOptions.filter(t=>{var o;return(o=x.value[0])==null?void 0:o.options.find($=>$.parent.slug===t.id)})||[]:[]),g=T(s?((we=x.value.find(t=>t.sku===s))==null?void 0:we.finishing)||((Ie=m.value[0])==null?void 0:Ie.finishing)||"":((Ce=m.value[0])==null?void 0:Ce.finishing)||""),b=gt(k.value.reduce((t,o)=>({...t,[o.id]:s?x.value.find($=>$.sku===s).options.find($=>$.parent.slug===o.id).slug:o.choices[0].value}),{})),C=t=>{var $,S,q;return(($=t.choices[0])==null?void 0:$.text)==="false"?[{text:"false",defaultValue:t.choices[0].value,value:(S=t.choices[1])==null?void 0:S.value,selected:s?b[t.id]===((q=t.choices[1])==null?void 0:q.value):!1}]:t.choices.map((P,V)=>({...P,selected:s?b[t.id]===P.value:V===0}))},p=B(()=>x.value.find(t=>{const o=t.finishing===g.value,$=i?t.options.reduce((S,q)=>S&&q.slug===b[q.parent.slug],!0):!0;return o&&$})),{finish:w}=qt(),N=T(!1);vt(()=>{me(p,async t=>{await ft({params:{slug:a.value.slug,main:a.value.mainProduct?!0:void 0},query:{sku:t==null?void 0:t.sku}},{replace:!0}),w(),N.value=!0},{immediate:!0})});const v=T(!1),z=T(),{height:Ye}=pe(z),fe=T(),{width:se}=pe(fe),ye=T();yt(ye,()=>v.value=!1);const Ge=B(()=>v.value?null:"click"),he=T(""),{headerEl:be,navEl:ke,mobileNavEl:et,modal:oe}=ve(ae()),{pointer:$e}=ae(),xe=T(),{width:le,height:ie}=pe(xe),J=T(!1),Ee=T($e.pointerType!=="mouse"),W=T(!0),tt=B(()=>({name:a.value.sku,images:a.value.variants.filter(t=>t.variantStatus).map(t=>{var o,$;return{url:($=(o=t.mainImage)==null?void 0:o[0])==null?void 0:$.url,name:t.sku}}).filter(t=>t.url)}));return me($e,t=>{t.pointerType==="mouse"&&(Ee.value=!1)}),(t,o)=>{var Oe,Se,qe,Ue,je,Be,Ne,ze,Me,Le,He,Re,Ae,De,Je;const $=Nt,S=D,q=Xe,P=Et,V=Ot,Y=wt,re=zt,at=Mt,nt=We,Pe=Q,st=Rt,Fe=It,ot=Dt,lt=St,it=Ke,Ve=Ct,Te=O("visible"),M=O("pad"),F=O("lay"),ue=O("cols"),rt=O("space"),ut=O("grid");return l((n(),r("main",null,[l((n(),r("div",null,[l((n(),r("section",Jt,[l((n(),r("aside",{style:L({height:t.$mq.m?`calc(100 * var(--vh) - ${e(be).height}px - ${e(ke).height}px * 2 - var(--spacer-m) * 2 - var(--spacer-xxs) * 5)`:"auto"}),class:"transparent",ref_key:"box",ref:ye},[l((n(),r("div",{class:K(["top",{box:e(J)||e(v)||!i||i&&!e(d)}])},[l((n(),r("div",null,[i&&e(d)&&!e(J)?l((n(),r("div",Kt,[_($,{onNoSelector:o[0]||(o[0]=f=>J.value=!0),modelValue:e(a),"onUpdate:modelValue":o[1]||(o[1]=f=>_e(a)?a.value=f:null),data:{collection:e(u)}},null,8,["modelValue","data"])])),[[Te,!e(v)]]):j("",!0),l((n(),r("div",null,[l(_(S,{data:{heading:e(v)?t.$t("files"):i&&e(d)&&!e(J)?"<br>":e(a).title,tag:1}},null,8,["data"]),[[M,"m"]]),l(_(q,{onClick:o[2]||(o[2]=f=>v.value=!1),data:{name:"cross",color:"grey",size:"m"}},null,512),[[A,e(v)],[F,{align:"center"}],[M,{x:"m"}]])])),[[A,e(J)||!i||i&&!e(d)||i&&e(v)],[F,{dir:"h",align:["initial","even"],fluid:!0}]])])),[[F,{dir:"o",align:["start"]}]]),l((n(),r("div",Xt,[l((n(),r("div",Zt,[l((n(),r("div",null,[_(S,{data:{heading:t.$t("sku"),typo:4,color:"grey"}},null,8,["data"]),(Oe=e(p))!=null&&Oe.sku?(n(),I(P,{key:0,data:{text:(Se=e(p))==null?void 0:Se.sku,typo:4}},null,8,["data"])):j("",!0)])),[[F,{gap:"xxs"}]]),e(m).length&&e(g)?l((n(),I(V,{key:0,modelValue:e(g),"onUpdate:modelValue":o[3]||(o[3]=f=>_e(g)?g.value=f:null),data:{variants:e(m)}},null,8,["modelValue","data"])),[[A,t.$mq.m]]):j("",!0),i&&e(k).length?l((n(),r("div",Qt,[(n(!0),r(X,null,Z(e(k),f=>{var ce;return n(),I(Y,{onUpdate:de=>e(b)[f.id]=Array.isArray(de)?de[0]:de,data:{...f,choices:C(f),type:((ce=f.choices[0])==null?void 0:ce.text)==="false"?"checkbox":"radio",theme:"inline",align:"start"}},null,8,["onUpdate","data"])}),256))])),[[F,{gap:"m"}]]):j("",!0),(qe=e(a).complementary)!=null&&qe.length?(n(),I(re,{key:2,data:{complementary:e(a).complementary}},null,8,["data"])):j("",!0),e(a).attributes.length?(n(),I(at,{key:3,data:{attributes:e(a).attributes}},null,8,["data"])):j("",!0),l((n(),r("div",null,[_(S,{data:{heading:t.$t("description"),typo:4,color:"grey"}},null,8,["data"]),_(P,{class:"description",data:{text:((Ue=e(p))==null?void 0:Ue.description)||e(a).description,typo:4}},null,8,["data"])])),[[F,{gap:"xxs"}]])])),[[Te,!e(v)],[M,"m"],[F,{gap:"l"}]]),G("div",{class:K(["height-transition",{active:e(v)}]),style:L({height:e(v)?`${e(Ye)}px`:"0px"})},[l(_(nt,{onUpdateUrl:o[4]||(o[4]=f=>he.value=f),ref_key:"filesEl",ref:z,data:{id:"desktop-files",productFiles:e(a).files,variantFiles:(je=e(p))==null?void 0:je.files},productImages:e(tt)},null,8,["data","productImages"]),[[M,"m"]])],6)])),[[F,{dir:"o",align:["end"]}],[M,{top:"xl"}]])],2)),[[F]]),l((n(),r("div",{ref_key:"buttons",ref:fe,class:K(["buttons",{files:e(v)}])},[G("div",{class:"button",style:L({width:e(v)?`${e(se)}px`:`${e(se)/2-1}px`})},[_(Pe,ht({[bt(e(Ge))]:o[5]||(o[5]=kt(()=>{t.$mq.m?v.value=!0:oe.value="files"},["prevent"]))},{data:{themes:["button","white-button"],align:"center",disabled:e(v),download:e(v)&&e(he)?e(a).slug:!1}}),{default:U(()=>[H(R(e(v)?t.$t("download"):t.$t("files")),1)]),_:1},16,["data"]),_(Fe,null,{default:U(()=>[(n(),I($t,{to:"#modal"},[l(_(st,{onCloseModal:o[6]||(o[6]=f=>oe.value=!1),data:{product:e(a),current:e(p)}},null,8,["data"]),[[A,e(oe)==="files"]])]))]),_:1})],4),G("div",{class:"button",style:L({width:e(v)?"0px":`${e(se)/2-1}px`})},[_(ot,{data:{sku:(Be=e(p))==null?void 0:Be.sku}},null,8,["data"])],4)],2)),[[F,{dir:"h"}]])],4)),[[ue,t.$mq.m?3:"1 / -1"],[F]]),e(m).length&&e(g)?l((n(),I(V,{key:0,id:"mobile-finishings",modelValue:e(g),"onUpdate:modelValue":o[7]||(o[7]=f=>_e(g)?g.value=f:null),data:{variants:e(m)}},null,8,["modelValue","data"])),[[M,"m"],[ue,"1 / -1"],[A,!t.$mq.m]]):j("",!0),l((n(),r("div",{key:t.$mq.m,ref_key:"mediaEl",ref:xe,class:"media",style:L({height:`calc(100 * var(--vh) - ${e(be).height}px - ${t.$mq.m?e(ke).height:e(et).height}px * 2 - var(--spacer-m) * 2 - var(--spacer-xxs) * 5)`})},[e(h)&&e(p)&&e(N)?(n(),I(Fe,{key:0},{default:U(()=>{var f;return[_(lt,{style:L({width:e(ie)>=e(le)?`${e(le)}px`:"auto",height:e(le)>e(ie)?`${e(ie)}px`:"auto"}),model:(f=e(a).model[0])==null?void 0:f.url,"model-options":e(a).modelOptions,current:e(p),variants:e(x)},null,8,["style","model","model-options","current","variants"]),l((n(),r("div",{class:K(["model-controls",{disabled:!e(W)}])},[l((n(),I(Pe,{onClick:o[8]||(o[8]=ce=>W.value=!e(W)),data:{themes:["button","light-button"]}},{default:U(()=>[H(R(t.$t(`model_${e(W)?"enable":"disable"}_cta`)),1)]),_:1})),[[rt,"m"]])],2)),[[F,{align:"end"}],[A,e(Ee)]])]}),_:1})):(n(),I(it,{key:1,style:{placeSelf:"center"},data:{image:(Ne=e(p))!=null&&Ne.mainImage.length?e(p).mainImage:e(a).mainImage,theme:"product-thumb",ratio:!1}},null,8,["data"]))],4)),[[ue,t.$mq.m?5:"1 / -1"],[F,{dir:"o"}]])])),[[ut,8]]),_(Ve,{class:"suggested",type:"products",data:{heading:t.$t("suggested"),...i?{brand:"kos"}:{collections:[(ze=e(u))==null?void 0:ze.slug]},productTypes:e(a).productTypes.map(f=>f.slug),excludeIds:[e(a).id],...e(d)?{mainProducts:!1}:{},customItems:e(a).suggested,...(Le=(Me=e(u))==null?void 0:Me.sortingProducts)!=null&&Le.length?{sortingProducts:e(u).sortingProducts}:{},limit:5,hideIfEmpty:!0}},null,8,["data"])])),[[F,{gap:"xxl"}]]),G("section",null,[_(Ve,{type:"collections",data:{heading:(Re=(He=e(u))==null?void 0:He.designers)!=null&&Re.length?`${t.$t("designed_by")} ${("joinEntryTitles"in t?t.joinEntryTitles:e(xt))((Ae=e(u))==null?void 0:Ae.designers)}`:t.$t("more_collections"),designers:(Je=(De=e(u))==null?void 0:De.designers)==null?void 0:Je.map(f=>f.slug),limit:4}},null,8,["data"])])])),[[M,{x:"m",top:"0",bottom:"m"}],[F,{gap:"xl"}]])}}},Yt=ne(Wt,[["__scopeId","data-v-670db029"]]),ia={__name:"[slug]",async setup(E){var k,g,b,C;let c,a;const{locale:i}=ge(),d=Ze(),{data:u,error:y}=([c,a]=ee(()=>te({key:`products-${d.params.slug}`,query:Pt,variables:{site:i.value,slug:d.params.slug},route:d})),c=await c,a(),c),{data:x}=([c,a]=ee(()=>{var p,w;return te({key:`collections-${(p=u.value.product.collections[0])==null?void 0:p.slug}`,query:Ft,variables:{site:i.value,slug:(w=u.value.product.collections[0])==null?void 0:w.slug,section:"collections"},route:d})}),c=await c,a(),c),{data:m}=([c,a]=ee(()=>te({key:"options",query:Vt,variables:{site:i.value},route:d})),c=await c,a(),c),{headerEl:h}=ve(ae()),{product:s}=u.value;return Qe(s,"overlay"),Ut(s==null?void 0:s.seo,s==null?void 0:s.title,s==null?void 0:s.description,(g=(k=s==null?void 0:s.mainImage)==null?void 0:k[0])==null?void 0:g.url,null,!1,{type:"product",image:(C=(b=s.mainImage)==null?void 0:b[0])==null?void 0:C.url,name:s.title,description:s.description,url:d.fullPath}),(p,w)=>{const N=ct,v=Yt,z=O("lay");return l((n(),r("main",null,[e(u).product.mainProduct?(n(),I(N,{key:0,data:{...e(x).entry}},null,8,["data"])):j("",!0),_(v,{style:L({paddingTop:e(u).product.mainProduct?"0px":`${e(h).height}px`}),data:{product:e(u).product,collection:e(x).entry,allOptions:e(m).entries}},null,8,["style","data"])])),[[z,{gap:"xl"}]])}}};export{ia as default};