import{d as D,an as re,n as t,h as s,o as l,b as v,au as Be,B as I,_ as E,y as ne,k as ie,$ as ae,j as le,m as ce,f as r,t as n,S as De,E as p,Z as Ee,aA as Ve,p as qe,a4 as We,g as je,L as Ke,u as Ge,F as C,I as Je,e as $,A as T,M as Ze,c as oe,z as U,T as Qe,s as Xe,v as Ye}from"./LrfSKRHt.js";import{_ as et}from"./BMVlqMcX.js";import{_ as tt}from"./VORCk58u.js";import{_ as ot}from"./DnPmYU5H.js";import{C as B}from"./DiwOddiq.js";import{u as st,_ as rt}from"./Vysv4iUc.js";import{u as nt}from"./BiFrrugl.js";import{f as it}from"./C_opeI5M.js";import{c as at,b as lt,a as ct}from"./Bsv1I75C.js";import{r as se}from"./CSGs8R6P.js";import{R as ut}from"./uXBH3zCt.js";const dt=D({__name:"Pill",props:{backgroundColor:{default:"WhiteSmoke"},size:{default:"medium"},bold:{type:Boolean,default:!1}},setup(a){re(f=>({"5d9839b9":t(S),c6a431ba:t(o)}));const _=a,o=s(()=>_.backgroundColor==="Black"?B.White:B.Black),S=s(()=>B[_.backgroundColor]),m=s(()=>_.bold?"bold":"");return(f,L)=>(l(),v("div",{class:I(["pill",[f.size,t(m)]])},[Be(f.$slots,"default",{},void 0,!0)],2))}}),vt=E(dt,[["__scopeId","data-v-4172d6f9"]]),_t=["src"],wt=D({__name:"Avatar",props:{channelId:{},language:{default:void 0},name:{default:""},backgroundColor:{default:void 0}},emits:["click"],setup(a){const _={da:"dk",en:"gb",nb:"no",sv:"se",cs:"cz"},o=a,{data:S}=ne("tycka-flag-codes",async()=>{var g;const u=ie(),b=ae("litium-tycka-flag-codes"),i=le(),c=await $fetch(i.apiEndpoint,{method:"POST",body:{query:"query getTyckaFlagCodes($url: String!) { session(url: $url) { tyckaFlagCodes } }",variables:{url:u}},headers:b});if(ce(c))throw new Error(c.errors.join(`\r
`));if(!((g=c.data)!=null&&g.session))throw new Error("Session is undefined");return c.data.session.tyckaFlagCodes},{deep:!1,dedupe:"defer",getCachedData:(u,w)=>w.payload.data[u]}),m=s(()=>o.name[0]),f=s(()=>{var b,i,c;const u=(i=(b=S.value)==null?void 0:b[o.channelId])==null?void 0:i.toLowerCase();if(u)return`/flags/${u}.svg`;const w=(c=o.language)==null?void 0:c.toLowerCase();if(w)return`/flags/${_[w]||w}.svg`}),L=s(()=>({backgroundColor:o.backgroundColor}));return(u,w)=>(l(),v("div",{class:"avatar",onClick:w[0]||(w[0]=b=>u.$emit("click"))},[r("div",{class:"avatar__fallback",style:De(t(L))},n(t(m)),5),u.language?(l(),v("img",{key:0,class:"avatar__flag",src:t(f),loading:"lazy"},null,8,_t)):p("",!0)]))}}),pt=E(wt,[["__scopeId","data-v-bfbfec2e"]]),mt=()=>{const a=Ee(Ve,void 0),_=nt("productVersionModalHistory");return{open:()=>{var m;_.value=(m=a==null?void 0:a.product.value)==null?void 0:m.versionHistoryAscending},close:()=>{_.value=void 0},versionHistoryAscending:_}},ht=qe("/icons/verified-icon.svg");var ue=(a=>(a.Latest="Latest",a.Previous="Previous",a))(ue||{});const de=a=>(Xe("data-v-f8856c8a"),a=a(),Ye(),a),gt={class:"review"},ft={class:"review__avatar-wrap"},bt={class:"review__reviewer-info-row"},yt={class:"review__reviewer-name"},kt={class:"review__reviewer-name-container"},St={class:"review__reviewer-display-name"},Ct={class:"review__reviewer-verified-status"},$t=de(()=>r("img",{src:ht,alt:"verified-user"},null,-1)),Tt={key:0,class:"review__reviewer-verified-status-label"},It={class:"review__date mobile"},Lt={key:0,class:"review__info-row"},zt={class:"review__info-row-label"},xt={class:"review__content-header"},Nt={class:"review__content-header-title"},Pt={class:"review__title"},At={class:"review__date desktop"},Mt={class:"review__content"},Ut={key:0,class:"review__translate-toggle"},Ot={class:"review__product-info-and-picture"},Rt={key:0,class:"review__product"},Ht={class:"review__product-info"},Ft={class:"review__info-row"},Bt={class:"review__info-row-label product-details"},Dt={class:"review__info-row"},Et={class:"review__info-row-label product-details"},Vt={class:"review__info-row"},qt={class:"review__info-row-label product-details"},Wt={class:"review__info-row"},jt={class:"review__info-row-label product-details"},Kt={class:"review__product-image-container"},Gt=["src"],Jt={class:"review__product-pills-and-helpful-votes"},Zt={key:0,class:"review__info-row"},Qt={key:1,class:"review__info-row review__info-product-version-row"},Xt={class:"review__product-helpful-vote-container"},Yt={key:0,class:"review__not-logged-in-error"},eo=["innerHTML"],to=de(()=>r("div",{class:"review__not-logged-in-error-arrow"},null,-1)),oo=D({__name:"Review",props:{review:{},smallReviewerContainerWidthInDesktop:{type:Boolean},version:{}},setup(a){re(e=>({ee930510:t(He)}));const _=ut.Orange,o=a,{$toMediaUrl:S}=We(),{formatPerceivedSize:m}=st(),f=je(),L=ie(),{apiEndpoint:u}=le(),{open:w}=mt(),b=Ke(),i=Ge(),c=C(!0),g=C(!1),O=C(!1),z=C(!1),x=C(!1),V=C(null),{data:q}=ne("litium-color-and-size-option-names",async()=>{var h,k;const e=ae("litium-color-and-size-option-names"),d=await $fetch(u,{method:"POST",credentials:"include",body:{query:`query getColorAndSizeOptionNames($url: String!) { session(url: $url) { channel {
                colorOptionNames
                sizeOptionNames
              }}}`,variables:{url:L}},headers:e});if(ce(d.data))throw new Error("Litium responded with error");if(!((k=(h=d.data)==null?void 0:h.session)!=null&&k.channel))throw new Error("No channel data in response");return{colorOptionNames:d.data.session.channel.colorOptionNames,sizeOptionNames:d.data.session.channel.sizeOptionNames}},{dedupe:"defer",deep:!1,getCachedData:(e,d)=>d.payload.data[e]}),ve=s(()=>{var e;return c.value&&o.review.language&&((e=o.review.translation)!=null&&e.title)?o.review.translation.title:o.review.title}),_e=s(()=>{var e;return c.value&&o.review.language&&((e=o.review.translation)!=null&&e.content)?o.review.translation.content:o.review.content}),W=s(()=>it(o.review.publishedAt,y.value)),R=s(()=>{var e;return(e=o.review.author)==null?void 0:e.name}),we=s(()=>{var e;return(e=R.value)==null?void 0:e.split(" ")[0]}),pe=s(()=>Number(o.review.rating)),me=s(()=>o.review.height?y.value==="en-US"||y.value==="en-GB"?Me(at(o.review.height)):`${o.review.height}cm`:null),he=s(()=>o.review.weight?y.value==="en-US"?`${Math.round(lt(o.review.weight))}lb`:y.value==="en-GB"?Ae(ct(o.review.weight)):`${o.review.weight}kg`:null),N=s(()=>G&&K.value&&J.value&&H.value),j=s(()=>{var h;if(!o.review.item.productUrls||!((h=i.channel)!=null&&h.systemId))return;const d=JSON.parse(o.review.item.productUrls.replace(/'/g,'"'))[i.channel.systemId];return d?new URL(d):null}),H=s(()=>{if(j.value)return`${j.value.pathname}?Color=${o.review.item.color}`}),K=s(()=>o.review.item.imageId),G=s(()=>o.review.item.baseProduct),ge=s(()=>S(K.value,{fillArea:{width:122,height:162},fancyName:`${Q.value.split(" ").join("-")}.png`,skipPixelRatioDetection:!0})),J=s(()=>{var e;return((e=q.value)==null?void 0:e.colorOptionNames[o.review.item.color])||o.review.item.color}),fe=s(()=>{var e;return((e=q.value)==null?void 0:e.sizeOptionNames[o.review.item.size])||o.review.item.size}),be=s(()=>se(i.websiteTexts.reviews__customermeasurementslabel,{name:we.value})),Z=s(()=>[me.value,he.value].filter(e=>e).join(", ")),Q=s(()=>{try{if(!y.value)throw new Error("Locale is not set");const e=JSON.parse(o.review.item.displayName.replace(/'/g,'"'));return(e==null?void 0:e[y.value])??""}catch{return""}}),ye=s(()=>!!Z.value.length),ke=s(()=>!!o.review.language&&!!o.review.translation&&(!!o.review.translation.title||!!o.review.translation.content)),Se=s(()=>c.value?i.websiteTexts.reviews__showoriginal:i.websiteTexts.reviews__showtranslation),X=s(()=>o.review.upvotes+(g.value?1:0)),Y=s(()=>X.value>=1?"teal":"grey"),Ce=s(()=>Y.value==="grey"?"hollow-grey":g.value?"solid-teal":"hollow-teal"),$e=s(()=>{var k,A,P;const e=(P=(A=(k=i.channel)==null?void 0:k.website)==null?void 0:A.websitePageLinks)==null?void 0:P.find(M=>M.fieldId==="LoginPageLinkPointer"),d=f.fullPath,h=e?`${e.url}?redirect=${encodeURIComponent(d)}`:"";return se(i.websiteTexts.reviews__notloggedinerrormessage,{url:h})}),F=s(()=>`votedAsHelpfulReview_${o.review.id}`),y=s(()=>{var e;return(e=i.channel)==null?void 0:e.locale}),Te=s(()=>i.websiteTexts.reviews__buysize),Ie=s(()=>i.websiteTexts.reviews__verified),Le=s(()=>i.websiteTexts.reviews__helpful),ze=s(()=>`${i.websiteTexts.reviews__articlenumber} ${G.value}`),xe=s(()=>i.websiteTexts.myreviews__perceivedsize),Ne=s(()=>i.websiteTexts.myreviews__perceivedlength),ee=s(()=>{if(o.version)return o.version===ue.Latest?i.websiteTexts.product__latestversion:i.websiteTexts.product__olderversion}),Pe=s(()=>b.person);Je(()=>{localStorage.getItem(F.value)&&(g.value=!0)});const Ae=e=>`${e.st}st. ${Math.round(e.lb)}lb`,Me=e=>`${e.ft}'${Math.round(e.in)}"`,Ue=()=>{c.value=!c.value},Oe=async()=>{if(!(z.value||g.value)){if(z.value=!0,!Pe.value){O.value=!0,setTimeout(()=>{O.value=!1,z.value=!1},5e3);return}if(!localStorage.getItem(F.value)){try{await $fetch(u,{method:"POST",credentials:"include",body:{query:`
          mutation Upvote($url: String!, $reviewId: String!) {
            session(url: $url) {
              upvoteReview(reviewId: $reviewId) {
                error
              }
            }
          }
        `,variables:{url:L,reviewId:o.review.id}}})}catch{z.value=!1;return}localStorage.setItem(F.value,"true"),g.value=!0,z.value=!1}}},Re=()=>{x.value=!x.value},He=s(()=>x.value?"100%":"100px"),te=s(()=>{var e;return(((e=V.value)==null?void 0:e.offsetHeight)??0)<100});return(e,d)=>{const h=pt,k=et,A=tt,P=ot,M=vt,Fe=rt;return l(),v("div",gt,[r("div",{class:I([{"review__reviewer-container--small-width":e.smallReviewerContainerWidthInDesktop},"review__reviewer-container"])},[r("div",ft,[$(h,{"channel-id":e.review.channelId,language:e.review.language,name:t(R)},null,8,["channel-id","language","name"])]),r("div",bt,[r("div",yt,[r("div",kt,[r("span",St,n(t(R)),1),r("div",Ct,[$t,e.review.manuallyVerified||e.review.verified?(l(),v("span",Tt,n(t(Ie)),1)):p("",!0)])]),r("span",It,n(t(W)),1)]),t(ye)?(l(),v("div",Lt,[r("span",zt,n(t(be)),1),T(" "+n(t(Z)),1)])):p("",!0)])],2),r("div",{ref_key:"reviewContent",ref:V,class:I(["review__content-container",{"review__content--closed":!t(x)&&!t(te)}])},[r("div",xt,[r("div",Nt,[r("div",Pt,n(t(ve)),1),$(k,{"star-size":18,rating:t(pe),color:t(_)},null,8,["rating","color"])]),r("span",At,n(t(W)),1)]),r("div",Mt,n(t(_e)),1),t(ke)?(l(),v("div",Ut,[r("a",{href:"#",onClick:Ze(Ue,["prevent"])},n(t(Se)),1)])):p("",!0)],2),t(te)?p("",!0):(l(),oe(A,{key:0,"pdp-variant":"",expanded:t(x),"full-width":"","hide-on-desktop":"",height:"4rem",onClick:Re},null,8,["expanded"])),r("div",{class:I(["review__product-container",{"review__product-container--site-review":!t(N),"review__product-container--small-size":e.smallReviewerContainerWidthInDesktop}])},[r("div",Ot,[t(N)?(l(),v("div",Rt,[r("div",Ht,[r("div",Ft,[r("span",Bt,n(t(Q)),1),$(P,{to:t(H)},{default:U(()=>[T(n(t(J)),1)]),_:1},8,["to"])]),r("div",Dt,[r("span",Et,n(t(Te)),1),T(" "+n(t(fe)),1)]),e.review.perceivedFits.length?(l(),v(Qe,{key:0},[r("div",Vt,[r("span",qt,n(t(xe)),1),r("span",null,n(t(m)(e.review.perceivedFits.size,"size")),1)]),r("div",Wt,[r("span",jt,n(t(Ne)),1),r("span",null,n(t(m)(e.review.perceivedFits.length,"length")),1)])],64)):p("",!0)])])):p("",!0),r("div",Kt,[t(N)?(l(),oe(P,{key:0,to:t(H)},{default:U(()=>[r("img",{loading:"lazy",class:"review__product-image",src:t(ge)},null,8,Gt)]),_:1},8,["to"])):p("",!0)])]),r("div",Jt,[r("div",null,[t(N)?(l(),v("div",Zt,[$(M,{class:"review__pill"},{default:U(()=>[T(n(t(ze)),1)]),_:1})])):p("",!0),t(ee)?(l(),v("div",Qt,[$(M,{class:"review__pill review__pill-clickable",onClick:t(w)},{default:U(()=>[T(n(t(ee)),1)]),_:1},8,["onClick"])])):p("",!0)]),r("div",Xt,[r("div",{class:I(["review__product-helpful-vote-row",{"review__product-helpful-vote--site-review":!t(N)}]),onClick:Oe},[r("span",null,n(t(Le)),1),r("span",{class:I([t(Y)==="teal"?"review__product-helpful-vote-number-teal":"review__product-helpful-vote-number-grey","review__product-helpful-vote-number-and-icon"])},[$(Fe,{variant:t(Ce)},null,8,["variant"]),T(" "+n(t(X)),1)],2),t(O)?(l(),v("div",Yt,[r("p",{class:"review__not-logged-in-error-label",innerHTML:t($e)},null,8,eo),to])):p("",!0)],2)])])],2)])}}}),po=E(oo,[["__scopeId","data-v-f8856c8a"]]);export{ue as P,vt as _,po as a,mt as u};