import{M as ne,P as E,I as ve,H as z,C as de}from"./Image.js";import{u as h,j as m,a as o,d as U,r as b}from"./index.js";import{V as ue,a as te}from"./Video.js";import{s as O,C as p}from"./styled-components.browser.esm.js";import{N as W,g as H}from"./translationUtils.js";import{b as M,a as pe,i as l,S as me,P as fe}from"./animate.es.js";import{U as ce,P as le,T as xe,a as $e,b as we,c as ye,d as ge}from"./User.js";import{u as be}from"./useWindowSize.js";const Te=({post:e,isLarge:s,usernameLocation:c})=>{var x,y,i;const r=(y=(x=e==null?void 0:e.taggedProducts)==null?void 0:x[0])==null?void 0:y.product,f=h(g=>g.postWidth);return m(Pe,{postWidth:f>400?400:f*(s?1.5:1),isLarge:s,$usernameLocation:c,children:[o("div",{className:"cevoid-post-header",children:o("div",{className:"cevoid-post-header-left",children:o(ce,{post:e})})}),r&&m("div",{className:"cevoid-post-footer",children:[m("div",{className:"cevoid-post-footer-left",children:[o("div",{className:"cevoid-post-product-title",children:U(r==null?void 0:r.title)}),(r==null?void 0:r.category)&&((i=r==null?void 0:r.category)==null?void 0:i.length)>3&&(r==null?void 0:r.category)!==void 0&&o("div",{className:"cevoid-post-product-category",children:U(r==null?void 0:r.category)})]}),o("div",{className:"cevoid-post-footer-right",children:o("div",{className:"cevoid-price",children:o(le,{product:r})})})]})]})},Pe=O.div` .cevoid-post-footer-left { min-width: 0px; .cevoid-post-product-title { font-size: calc(${e=>e.postWidth/23}px); line-height: 1.2em; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } .cevoid-post-product-category { font-size: calc(${e=>e.postWidth/27}px); line-height: 1.2em; margin-top: 2px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; text-transform: capitalize; } } .cevoid-price { display: flex; grid-gap: 3px; margin-top: 10px; align-items: baseline; flex-direction: column; text-align: right; .cevoid-original-price { font-size: calc(${e=>e.postWidth/16}px); line-height: 1.1em; width: 100%; white-space: nowrap; &.cevoid-is-discounted { text-decoration: line-through; opacity: 0.6; font-size: calc(${e=>e.postWidth/21}px); font-weight: normal; } } .cevoid-sale-price { font-size: 16px; line-height: 1.1em; font-size: calc(${e=>e.postWidth/16}px); width: 100%; white-space: nowrap; } } ${e=>e.$usernameLocation==="OUTSIDE"&&p` position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; .cevoid-post-header { position: absolute; top: 100%; left: 0px; right: 0px; width: 100%; } `} `,Ee=O.div``,Oe=({post:e})=>o(Ee,{children:o("div",{className:"cevoid-post-header",children:o("div",{className:"cevoid-post-header-left",children:o(ce,{post:e})})})});function Ne({tag:e,index:s,postId:c,tagInFocus:r,setHasHoveredOtherProduct:f,setPostHoveredProduct:x,...y}){var C,R,V,L,_;const i=h(n=>n.shortId),g=h(n=>n.triggerEvent),[N,T]=b.exports.useState(!1),u=h(n=>{var v,k;return(k=(v=n.market)==null?void 0:v.settings)==null?void 0:k.outOfStockBehavior}),P=h(n=>{var v;return(v=n.settings)==null?void 0:v.productLinkBehaviour}),a=((C=e==null?void 0:e.product)==null?void 0:C.status)==="UNAVAILABLE",t=U((R=e==null?void 0:e.product)==null?void 0:R.title),$=n=>{var v;n.stopPropagation(),!a&&g("product.click",{product:(v=e==null?void 0:e.product)==null?void 0:v.primaryId,post:c,area:"tag"})},w=()=>{var n;window.innerWidth>768&&(T(!0),x(`post-tag-${(n=e==null?void 0:e.product)==null?void 0:n._id}-${c}-${s}-${i}`),f(!0))},A=()=>{window.innerWidth>768&&(T(!1),x(void 0))},I=()=>{var n;return a?o("div",{className:"cevoid-not-available",children:o(W,{children:H("notAvailableTitle","Not available in your region")})}):u==="show_out_of_stock_text"&&((n=e==null?void 0:e.product)==null?void 0:n.availability)==="OUT_OF_STOCK"?o("div",{className:"cevoid-not-available",children:o(W,{children:H("outOfStock","Out of stock")})}):o(le,{product:e==null?void 0:e.product})};return b.exports.useEffect(()=>{var n,v;if(r){T(!0),M(`.post-tag-${(n=e==null?void 0:e.product)==null?void 0:n._id}-${c}-${s}-${i}`,{opacity:1,pointerEvents:"all"},{duration:.3});return}M(`.post-tag-${(v=e==null?void 0:e.product)==null?void 0:v._id}-${c}-${s}-${i}`,{opacity:0,pointerEvents:"none"},{duration:.3})},[r]),!(e!=null&&e.x)&&!(e!=null&&e.y)?null:o(xe,{x:e==null?void 0:e.x,y:e==null?void 0:e.y,$hover:N,className:"cevoid-tag-wrapper",...y,children:m($e,{$hover:N,onMouseEnter:()=>w(),onMouseLeave:()=>A(),children:[m("div",{className:"cevoid-tag",onClick:n=>$(n),children:[o("div",{className:"cevoid-before-tag"}),o("div",{className:"cevoid-after-tag"}),!a&&o("a",{"aria-label":`Go to ${t}`,href:(V=e==null?void 0:e.product)==null?void 0:V.url,target:P==="TAB"?"_blank":"_self",rel:"noopener noreferrer"})]}),o("div",{className:"cevoid-tag-inner",children:o(we,{className:`post-tag-${(L=e==null?void 0:e.product)==null?void 0:L._id}-${c}-${s}-${i}`,horizontal:(e==null?void 0:e.x)>50?"left":"right",vertical:(e==null?void 0:e.y)>50?"bottom":"top",onClick:n=>$(n),children:m("div",{className:"cevoid-tooltip-inner",children:[o("div",{className:"cevoid-tooltip-title",children:o(ye,{lines:2,ellipsis:"...",children:t})}),m("div",{className:"cevoid-tooltip-footer",children:[o("div",{className:"cevoid-tooltip-price",children:I()}),!a&&o(pe,{})]}),!a&&o("a",{"aria-label":`Go to ${t}`,href:(_=e==null?void 0:e.product)==null?void 0:_.url,target:P==="TAB"?"_blank":"_self",rel:"noopener noreferrer"})]})})})]})})}function Le({post:e,isLarge:s,isSingle:c}){const{taggedProducts:r}=e,f=h(a=>a.shortId),[x,y]=b.exports.useState(void 0),[i,g]=b.exports.useState(!1),N=h(a=>{var t,$;return($=(t=a.market)==null?void 0:t.settings)==null?void 0:$.outOfStockBehavior}),T=h(a=>{var t;return(t=a.settings)==null?void 0:t.displayTags}),u=N==="hide"?r.filter(a=>{var t;return((t=a==null?void 0:a.product)==null?void 0:t.availability)!=="OUT_OF_STOCK"}):r;b.exports.useEffect(()=>{(s||c)&&M(`.tag-layout-${e==null?void 0:e._id}-${f}`,{opacity:1},{duration:.2})},[]);const P=()=>{if(s||c){g(!1);return}};return m(_e,{className:`tag-layout-${e==null?void 0:e._id}-${f}`,$isSingle:c,$displayTags:T,onMouseLeave:()=>P(),children:[o("div",{className:"cevoid-post-tags",children:u==null?void 0:u.map((a,t)=>{var $,w;return o(Ne,{tag:a,index:t,postId:e==null?void 0:e._id,tagInFocus:x?x===`post-tag-${($=a==null?void 0:a.product)==null?void 0:$._id}-${e==null?void 0:e._id}-${t}-${f}`:(c||s)&&!i?t===0:!1,setHasHoveredOtherProduct:g,setPostHoveredProduct:y},`post-tag-${(w=a==null?void 0:a.product)==null?void 0:w._id}-${e==null?void 0:e._id}-${t}-${f}`)})}),(u==null?void 0:u.length)>0&&!c&&m("div",{className:"cevoid-number-of-products",children:[o(me,{}),o("div",{className:"cevoid-products-text",children:u==null?void 0:u.length})]})]})}const _e=O.div` position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; height: 100%; width: 100%; z-index: 2; .cevoid-number-of-products { background: rgba(0, 0, 0, 0.7); border-radius: 100px; color: #fff; position: absolute; display: flex; align-items: center; justify-content: center; line-height: 1em; font-size: 11px; padding: 4px 7px 4px 6px; gap: 4px; left: 5px; bottom: 5px; z-index: 3; svg { width: 12px; height: 12px; } ${l.greaterThan("500px")` bottom: 10px; left: 10px; padding: 6px 11px 6px 10px; font-size: 11px; grid-gap: 6px; svg { width: 16px; height: 16px; } `} ${l.greaterThan("medium")` display: none; `} } .cevoid-post-tags { transition: 0.2s opacity ease-in-out; ${e=>!e.$isSingle&&p` display: none; ${l.greaterThan("medium")` display: block; opacity: 0; `} `} } ${e=>e.$displayTags==="ON_HOVER"&&p` ${l.greaterThan("medium")` &:hover { .cevoid-post-tags { opacity: 1; } } `} `} ${e=>e.$displayTags==="ALWAYS"&&p` ${l.greaterThan("medium")` .cevoid-post-tags { opacity: 1 !important; } `} `} `,ke=({post:e,isLarge:s=!1,isSingle:c=!1,index:r,allowClick:f})=>{var L,_,n,v,k,D,j,F,Y,G,K,Z,q,J,Q;const x=h(d=>d.increaseRenderedPosts),y=h(d=>d.autoPlayingVideoPost),i=h(d=>d.settings),g=h(d=>d.postWidth),N=h(d=>d.setPopupPostIndex),T=h(d=>d.popupPostIndex),u=h(d=>d.setModalOpen),P=h(d=>d.triggerEvent),[a,t]=b.exports.useState(!1),[$,w]=b.exports.useState(!1),{device:A}=be(),I=A!=="desktop"&&window.devicePixelRatio>=2?2:1,C=s||((L=e==null?void 0:e.media)==null?void 0:L.aspectRatio)>=1.4?2*I:1*I,R=Math.round(g*C),V=()=>{var d,S,X,ee,ie,oe,re;if(!(f&&!f(r))){if(P("post.click",{post:e==null?void 0:e._id,taggedProducts:(d=e==null?void 0:e.taggedProducts)==null?void 0:d.map(B=>{var ae;return(ae=B==null?void 0:B.product)==null?void 0:ae.primaryId})}),(i==null?void 0:i.clickBehaviour)===de.SOCIAL&&(e==null?void 0:e.instagramUrl)){window.open(e==null?void 0:e.instagramUrl,"_blank");return}if((i==null?void 0:i.clickBehaviour)===de.PRODUCT&&((X=(S=e==null?void 0:e.taggedProducts[0])==null?void 0:S.product)==null?void 0:X.url)){P("product.click",{product:(ie=(ee=e==null?void 0:e.taggedProducts[0])==null?void 0:ee.product)==null?void 0:ie.primaryId,post:e==null?void 0:e._id,area:"post"}),window.location.href=(re=(oe=e==null?void 0:e.taggedProducts[0])==null?void 0:oe.product)==null?void 0:re.url;return}N(r),u(!0)}};return b.exports.useEffect(()=>{var d,S;if((e==null?void 0:e.type)===ne.VIDEO){if(((d=e==null?void 0:e.media)==null?void 0:d.videoLength)&&((S=e==null?void 0:e.media)==null?void 0:S.videoLength)>61){w(!1);return}if(c){w(!0);return}if(s&&(i==null?void 0:i.autoPlayVideo)){w(!0);return}if(y.includes(e==null?void 0:e._id)&&(i==null?void 0:i.autoPlayVideo)){w(!0);return}w(!1)}},[y]),b.exports.useEffect(()=>{x()},[]),m(ze,{zIndex:T===r||a?4:1,hover:a,onClick:()=>V(),onMouseLeave:()=>t(!1),onMouseEnter:()=>t(!0),className:`p-${e==null?void 0:e._id} cevoid-not-loaded`,isSingle:c,hoverEffect:i.postLayout===E.SOCIAL||i.postLayout===E.CLEAN?i.hoverEffect:null,$usernameLocation:i==null?void 0:i.usernameLocation,$usernameAlignment:i==null?void 0:i.usernameAlignment,children:[m("div",{className:"cevoid-post-inner",children:[(!!g||c)&&o("div",{className:"cevoid-media-wrapper",children:(e==null?void 0:e.type)===ne.VIDEO?m(Se,{children:[o(ue,{src:(_=e==null?void 0:e.media)==null?void 0:_.location,post:e,autoPlay:$,isMuted:!0}),o("div",{className:"cevoid-post-video-icon",children:o(fe,{isPlaying:!1})})]}):o(se,{children:o(ve,{post:e,srcSet:` ${(n=e==null?void 0:e.media)==null?void 0:n.location}?class=160 160w, ${(v=e==null?void 0:e.media)==null?void 0:v.location}?class=200 200w, ${(k=e==null?void 0:e.media)==null?void 0:k.location}?class=240 240w, ${(D=e==null?void 0:e.media)==null?void 0:D.location}?class=280 280w, ${(j=e==null?void 0:e.media)==null?void 0:j.location}?class=320 320w, ${(F=e==null?void 0:e.media)==null?void 0:F.location}?class=360 360w, ${(Y=e==null?void 0:e.media)==null?void 0:Y.location}?class=400 400w, ${(G=e==null?void 0:e.media)==null?void 0:G.location}?class=480 480w, ${(K=e==null?void 0:e.media)==null?void 0:K.location}?class=640 640w, ${(Z=e==null?void 0:e.media)==null?void 0:Z.location}?class=750 750w, ${(q=e==null?void 0:e.media)==null?void 0:q.location}?class=1080 1080w `,src:(J=e==null?void 0:e.media)==null?void 0:J.location,hash:(Q=e==null?void 0:e.media)==null?void 0:Q.hash,sizes:`${R}px`,loading:"lazy"})})}),(i==null?void 0:i.postLayout)===E.PRODUCT&&o(Te,{post:e,isLarge:s,usernameLocation:i==null?void 0:i.usernameLocation}),((i==null?void 0:i.postLayout)===E.TAG||c)&&o(Le,{post:e,isLarge:s,isSingle:c}),A!=="mobile"&&(i.postLayout===E.SOCIAL||i.postLayout===E.CLEAN)&&(i.hoverEffect===z.OVERLAY_CENTER||i.hoverEffect===z.OVERLAY_BOTTOM_LEFT)&&m(he,{hoverEffect:i.hoverEffect,children:[o("div",{className:"cevoid-hover-background"}),o("div",{className:"cevoid-hover-text",children:o(W,{children:H("hoverOverlayText","Shop this look")})})]})]}),(i==null?void 0:i.postLayout)===E.SOCIAL&&o(Oe,{post:e})]})};var He=ke;const se=O.div` height: 100%; width: 100%; transition: transform 0.35s cubic-bezier(0.39, 0.575, 0.565, 1); user-select: none; img { display: block; } `,Se=O.div``,he=O.div` transition: all 0.35s cubic-bezier(0.39, 0.575, 0.565, 1); user-select: none; color: var(--cevoid-hover-text-color); opacity: 0; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; height: 100%; width: 100%; border-radius: var(--cevoid-corner-roundness); pointer-events: none; z-index: 2; overflow: hidden; .cevoid-hover-background { background: var(--cevoid-hover-background-color); opacity: var(--cevoid-hover-background-opacity); position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; height: 100%; width: 100%; } .cevoid-hover-text { position: absolute; text-transform: uppercase; font-size: 14px; ${e=>e.hoverEffect===z.OVERLAY_CENTER&&p` top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; `} ${e=>e.hoverEffect===z.OVERLAY_BOTTOM_LEFT&&p` bottom: 30px; left: 30px; `} } `,ze=O.div` position: relative; width: 100%; height: 100%; color: #fff; z-index: ${({zIndex:e})=>e}; opacity: 0; transform: scale(0.95); cursor: pointer; .cevoid-post-inner { position: relative; .cevoid-media-wrapper { overflow: hidden; border-radius: var(--cevoid-corner-roundness); ${e=>e.$usernameLocation==="OUTSIDE"&&p` height: unset !important; `} } } ${ge} { font-size: 14px; line-height: 1.2em; ${l.greaterThan("small")` font-size: 16px; `} span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } svg { height: 16px; width: 16px; min-width: 16px; ${l.greaterThan("small")` height: 18px; width: 18px; min-width: 18px; `} } } ${e=>e.hoverEffect===z.ZOOM&&p` z-index: 2; &:hover { ${se}, ${te} video, ${te} img { ${l.greaterThan("medium")` transition: transform 4s cubic-bezier(0.39, 0.575, 0.565, 1); transform: scale(1.2); `} } } `} &:hover { ${he} { opacity: 1; } } .cevoid-post-header { ${e=>e.$usernameAlignment==="LEFT"&&p` justify-content: start; `} ${e=>e.$usernameAlignment==="CENTER"&&p` justify-content: center; `} ${e=>e.$usernameAlignment==="RIGHT"&&p` justify-content: end; `} ${e=>e.$usernameLocation==="OUTSIDE"&&p` color: var(--text); padding: 3vw 0px; display: flex; color: #000; ${l.greaterThan("medium")` padding: 1.5vw 0px; `} ${l.greaterThan("large")` padding: 1vw 0px; `} `} ${e=>e.$usernameLocation==="INSIDE"&&p` position: absolute; top: 0px; left: 0px; right: 0px; display: flex; grid-gap: var(--cevoid-spacing-md); padding: 3.5vw; padding: clamp(10px, 3.5vw, 30px); color: #fff; svg { color: #fff !important; } span.notranslate { color: #fff !important; } ${l.greaterThan("medium")` padding: 2vw; padding: clamp(10px, 2vw, 30px); `} ${l.greaterThan("large")` padding: 1.2vw; padding: clamp(10px, 1.2vw, 30px); `} & > div { position: relative; z-index: 2; min-width: 1px; } &:before { content: ''; position: absolute; top: 0px; left: 0px; right: 0px; height: 150%; pointer-events: none; border-radius: var(--cevoid-corner-roundness) var(--cevoid-corner-roundness) 0px 0px; background-image: linear-gradient( to bottom, hsla(0, 0%, 0%, 0.3) 0%, hsla(0, 0%, 0%, 0.296) 8.1%, hsla(0, 0%, 0%, 0.285) 15.5%, hsla(0, 0%, 0%, 0.269) 22.5%, hsla(0, 0%, 0%, 0.247) 29%, hsla(0, 0%, 0%, 0.222) 35.3%, hsla(0, 0%, 0%, 0.194) 41.2%, hsla(0, 0%, 0%, 0.165) 47.1%, hsla(0, 0%, 0%, 0.135) 52.9%, hsla(0, 0%, 0%, 0.106) 58.8%, hsla(0, 0%, 0%, 0.078) 64.7%, hsla(0, 0%, 0%, 0.053) 71%, hsla(0, 0%, 0%, 0.031) 77.5%, hsla(0, 0%, 0%, 0.015) 84.5%, hsla(0, 0%, 0%, 0.004) 91.9%, hsla(0, 0%, 0%, 0) 100% ); z-index: 2; } `} } .cevoid-post-video-icon { position: absolute; top: 0px; right: 0px; pointer-events: none; padding: 3.5vw; padding: clamp(10px, 3.5vw, 20px); z-index: 3; ${l.greaterThan("medium")` padding: 2vw; padding: clamp(10px, 2vw, 20px); `} ${l.greaterThan("large")` padding: 1.2vw; padding: clamp(10px, 1.2vw, 20px); `} svg { height: 16px; width: 16px; ${l.greaterThan("small")` height: 18px; width: 18px; `} } } .cevoid-post-footer { position: absolute; bottom: 0px; left: 0px; right: 0px; display: flex; justify-content: space-between; align-items: flex-end; grid-gap: var(--cevoid-spacing-md); padding: 3.5vw; padding: clamp(10px, 3.5vw, 30px); ${l.greaterThan("medium")` padding: 2vw; padding: clamp(10px, 2vw, 30px); `} ${l.greaterThan("large")` padding: 1.2vw; padding: clamp(10px, 1.2vw, 30px); `} & > div { position: relative; z-index: 2; } &:before { content: ''; position: absolute; bottom: 0px; left: 0px; right: 0px; height: 150%; pointer-events: none; border-radius: 0px 0px var(--cevoid-corner-roundness) var(--cevoid-corner-roundness); background-image: linear-gradient( to top, hsla(0, 0%, 0%, 0.3) 0%, hsla(0, 0%, 0%, 0.296) 8.1%, hsla(0, 0%, 0%, 0.285) 15.5%, hsla(0, 0%, 0%, 0.269) 22.5%, hsla(0, 0%, 0%, 0.247) 29%, hsla(0, 0%, 0%, 0.222) 35.3%, hsla(0, 0%, 0%, 0.194) 41.2%, hsla(0, 0%, 0%, 0.165) 47.1%, hsla(0, 0%, 0%, 0.135) 52.9%, hsla(0, 0%, 0%, 0.106) 58.8%, hsla(0, 0%, 0%, 0.078) 64.7%, hsla(0, 0%, 0%, 0.053) 71%, hsla(0, 0%, 0%, 0.031) 77.5%, hsla(0, 0%, 0%, 0.015) 84.5%, hsla(0, 0%, 0%, 0.004) 91.9%, hsla(0, 0%, 0%, 0) 100% ); z-index: 2; } } `;export{He as P,se as a,Se as b};